Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/gatsby/cache-dir/__tests__/find-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ describe(`find-path`, () => {
global.__BASE_PATH__ = `/blog`
expect(cleanPath(`/blog/mypath`)).toBe(`/mypath`)
})

it(`strip out a complex basePrefix`, () => {
global.__BASE_PATH__ = `/test/blog`
expect(cleanPath(`/test/blog/new`)).toBe(`/new`)
})

it(`strip out an encoded basePrefix`, () => {
global.__BASE_PATH__ = encodeURIComponent(`/тест`)
expect(cleanPath(`/тест/mypath`)).toBe(`/mypath`)
})
})

describe(`findMatchPath`, () => {
Expand Down
5 changes: 4 additions & 1 deletion packages/gatsby/cache-dir/find-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ let matchPaths = []
const trimPathname = rawPathname => {
const pathname = decodeURIComponent(rawPathname)
// Remove the pathPrefix from the pathname.
const trimmedPathname = stripPrefix(pathname, __BASE_PATH__)
const trimmedPathname = stripPrefix(
pathname,
decodeURIComponent(__BASE_PATH__)
)
// Remove any hashfragment
.split(`#`)[0]
// Remove search query
Expand Down