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 file too long on tmp file create #2132

Merged
merged 2 commits into from
Feb 3, 2025
Merged

Conversation

8W9aG
Copy link
Contributor

@8W9aG 8W9aG commented Jan 31, 2025

  • Splits the extension on a ? query parameter
  • Ensure that the filename in URLPath is truncated

As an addendum I don't actually know how this comes to be, in the sense that this was originally created by an input that is a Path type which gets converted to a URLPath and during that conversion the truncation of the filename happens. The truncation is based of parsing the URL and using its path attribute which should not include queries. However they somehow sneak past this check and show up in the tempfile NamedTemporaryFile method. In light of this I've opted to check the length on creation of the URLPath construction and provided some tests to verify that.

* Splits the extension on a ? query parameter
* Ensure that the filename in URLPath is truncated
@8W9aG 8W9aG requested review from meatballhat, daanelson, NikhilSinha1 and a team January 31, 2025 20:41
@daanelson
Copy link
Contributor

lgtm! odd that we don't know exactly how these filenames sneak in there (you'd think they'd all be shortened w/get_filename); regardless looks like this fixes it.

@8W9aG 8W9aG enabled auto-merge (squash) February 3, 2025 22:38
@8W9aG 8W9aG merged commit 0e36b61 into main Feb 3, 2025
21 checks passed
@8W9aG 8W9aG deleted the sackfield/fix-file-too-long branch February 3, 2025 23:15
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.

2 participants