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

fix(prerender): check each segment length is less than 255 chars and whole path 1024 #757

Merged
merged 6 commits into from
Dec 15, 2022

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Dec 15, 2022

When prerendering routes, we create a filesystem entry with directory structure corresponding to the route and serve then in production as static files.

Due to filesystem limitations (see this table for reference) filename (and directory names) can have maximum of 255 characters in most popular filesystem implementations while generally there is less limit (at least documented) limitation for the full path.

This fixes nitro check to validate each segment length splitted by / instead of the whole path against 255 limit. Also adds a visible warning log when skipping routes due to filesystem limits.

APFS, at least also has a limitation on full path as well which is undocumented but causes ENAMETOOLONG error when while path (including path to /.../project/.output/public) is longer than 1024. I have made it a soft warning to ensure we at least warn about cross platform possible issues.

@codecov
Copy link

codecov bot commented Dec 15, 2022

Codecov Report

Merging #757 (61649ed) into main (cbcd068) will decrease coverage by 0.10%.
The diff coverage is 43.33%.

❗ Current head 61649ed differs from pull request most recent head f2601db. Consider uploading reports for the commit f2601db to get more accurate results

@@            Coverage Diff             @@
##             main     #757      +/-   ##
==========================================
- Coverage   72.35%   72.25%   -0.11%     
==========================================
  Files          57       57              
  Lines        5123     5151      +28     
  Branches      554      555       +1     
==========================================
+ Hits         3707     3722      +15     
- Misses       1406     1419      +13     
  Partials       10       10              
Impacted Files Coverage Δ
src/prerender.ts 84.53% <43.33%> (-3.47%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pi0 pi0 changed the title fix(prerender): check each segment length is less than 255 chars fix(prerender): check each segment length is less than 255 chars and whole path 1024 Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant