Merge pull request #20 from aaronmccall/master

Correct issue where top-level (only one initial slash) paths have no name
This commit is contained in:
fehguy
2012-06-21 15:12:37 -07:00

View File

@@ -92,7 +92,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) {