diff --git a/src/lib/utils.js b/src/lib/utils.js index dd2c760a..d468eb73 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -142,7 +142,7 @@ let match = (path, uri) => pick([{ path }], uri); // require less contextual information and (fingers crossed) be more intuitive. let resolve = (to, base) => { // /foo/bar, /baz/qux => /foo/bar - if (startsWith(to, "/")) { + if (typeof to === "number" || startsWith(to, "/")) { return to; } diff --git a/src/lib/utils.test.js b/src/lib/utils.test.js index b34deb29..08051119 100644 --- a/src/lib/utils.test.js +++ b/src/lib/utils.test.js @@ -84,6 +84,7 @@ describe("resolve", () => { expect(resolve("/groups?some=query", "/users?some=thing")).toEqual( "/groups?some=query" ); + expect(resolve(-1)).toEqual(-1); }); });