Skip to content

Commit

Permalink
Handle trailing slashes in basename
Browse files Browse the repository at this point in the history
  • Loading branch information
Davis Kim committed Oct 26, 2015
1 parent 8da759f commit 1934718
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/useBasename.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ function useBasename(createHistory) {
if (typeof path === 'string')
path = parsePath(path)

const pathname = basename + path.pathname
const pname = path.pathname
const normalizedBasename = basename.slice(-1) === '/' ? basename : basename + '/'
const normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname
const pathname = normalizedBasename + normalizedPathname

return {
...path,
Expand Down

0 comments on commit 1934718

Please sign in to comment.