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

manifestTransform for dynamic routes misses catch all routes #223

Closed
Pikachews opened this issue Jun 13, 2021 · 1 comment
Closed

manifestTransform for dynamic routes misses catch all routes #223

Pikachews opened this issue Jun 13, 2021 · 1 comment
Labels
bug Something isn't working done

Comments

@Pikachews
Copy link

Pikachews commented Jun 13, 2021

Summary

The following snippet seems to be intended to transform the square brackets ([/]) in the file names into the respective HTML entities (%5B/%5D). However, it misses the case of catch-all routes due to trying to also matching the / preceding a [.

next-pwa/index.js

Lines 219 to 223 in 334c5de

const manifest = manifestEntries.map(m => {
m.url = m.url.replace(/\/\[/g, '/%5B').replace(/\]/g, '%5D')
m.revision = buildId
return m
})

This ends up transforming /path/to/file/[[...slug]]-hash.js to /path/to/file/%5B[...slug%5D%5D-hash.js, which does not end up matching the request (/path/to/file/%5B%5B...slug%5D%5D-hash.js).

Not sure if there are other effects to this, but removing the forward slash from the match seems to fix the problem.

Versions

  • next-pwa: 5.2.21
  • next: 10.2.3

Expected Behaviors

The script should be properly cached the at installation and not requested again when the page requiring it is loaded.

Screenshots

File in the workbox-precache after PWA caches at installation:
image

File in the static-js-assets cache after being requested + cached:
image

@Pikachews Pikachews added the bug Something isn't working label Jun 13, 2021
@shadowwalker
Copy link
Owner

Fixed, update to latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done
Projects
None yet
Development

No branches or pull requests

2 participants