Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute path calculated not correctly in swagger.js #415

Closed
Novarg opened this issue Mar 5, 2014 · 1 comment
Closed

Absolute path calculated not correctly in swagger.js #415

Novarg opened this issue Mar 5, 2014 · 1 comment

Comments

@Novarg
Copy link

Novarg commented Mar 5, 2014

Abs path in getAbsoluteBasePath from swagger.js calculated not correctly in case when relativeBasePath is /. Currently it returns whole url except slash itself. When the basePath is / then we should treat url as <proto>://<domain> (root of the domain path). Check the patch to see what i mean.

--- dist/lib/swagger.js (revision c92e9a14b98a99064a6256a71706b6b586271a98)
+++ dist/lib/swagger.js (revision )
@@ -381,7 +381,9 @@
       return url + "/" + relativeBasePath;
     }
   } else if (relativeBasePath === "/") {
-    return url.substring(0, pos);
+    parts = url.split("/");
+    url = parts[0] + "//" + parts[2];
+    return url;
   } else {
     return url.substring(0, pos) + relativeBasePath;
   }
@fehguy
Copy link
Contributor

fehguy commented Mar 5, 2014

I hate to bounce this around, but it really belongs here:

https://github.com/wordnik/swagger-js

Swagger-js is included with swagger-ui via pacakge.json

@Novarg Novarg closed this as completed Mar 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants