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

Export can fail to create because generated filename is too long. #38

Open
westi opened this issue May 15, 2018 · 2 comments
Open

Export can fail to create because generated filename is too long. #38

westi opened this issue May 15, 2018 · 2 comments

Comments

@westi
Copy link

westi commented May 15, 2018

Because we use get_bloginfo( 'name' ); to generate the filename for the export and this is user supplied data we can end up generating a very long filename which then we can't save to disk.

We should consider limiting the info we pull from here using substr or using something different.

@schlessera
Copy link
Member

Yes, I agree, just taking on a potentially unlimited string as a filename should be considered a bug.

Are you up to producing a pull request for the above?

@schlessera
Copy link
Member

From @abdullah1908 on Slack:

I am just here to confirm about the length we should use for the site name like $sitename = sanitize_key( substr(get_bloginfo( 'name' ), 15));

We should stick with something that makes sense in terms of striving for maximum compatibility, while still not introducing a very arbitrary limitation.

Googling for POSIX limits brought me to this page: http://www.gnu.org/software/automake/manual/html_node/Limitations-on-File-Names.html:

Portable POSIX file names cannot contain components that exceed a 14-byte limit, but nowadays it’s normally safe to assume the more-generous XOPEN limit of 255 bytes. POSIX limits file names to 255 bytes (XOPEN allows 1023 bytes), but you may want to limit a source tarball to file names of 99 bytes to avoid interoperability problems with old versions of tar.

I'd say let's be conservative and stick to the 99 bytes limitation that tarballs seem to require for complete compatbility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants