From 6da589612cb1e4183135de52950e5396da49c074 Mon Sep 17 00:00:00 2001 From: Aaron McCall Date: Tue, 17 Apr 2012 16:21:28 -0700 Subject: [PATCH] Corrected bug where top level (only one initial '/') api paths get no name. --- source/javascripts/swagger-service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/javascripts/swagger-service.js b/source/javascripts/swagger-service.js index 1cf49d2e..b172d23e 100644 --- a/source/javascripts/swagger-service.js +++ b/source/javascripts/swagger-service.js @@ -91,7 +91,7 @@ function SwaggerService(discoveryUrl, _apiKey, statusCallback) { if (atts) this.load(atts); var sep = this.path.lastIndexOf("/"); - this.name = this.path.substr(0, sep).replace(".{format}", "").replace(/\//g, "_"); + this.name = (sep!==0?this.path.substr(0, sep):this.path).replace(".{format}", "").replace(/\//g, "_"); var secondPathSeperatorIndex = this.path.indexOf("/", 1); if (secondPathSeperatorIndex > 0) {