Skip to content

Absolute path calculated not correctly in swagger.js #415

@Novarg

Description

@Novarg

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;
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions