Corrected bug where top level (only one initial '/') api paths get no name.

This commit is contained in:
Aaron McCall
2012-04-17 16:21:28 -07:00
parent 75d7758c53
commit 6da589612c

View File

@@ -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) {