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

Support custom filename to be provided to URLFile #2004

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

aron
Copy link
Contributor

@aron aron commented Oct 18, 2024

This commit works around an issue where the basename of the URL many not
actually contain a file extension and the uploader logic cannot infer
the mime type for the file.

We stash the name when pickling and extract it again when unpickling.
The getattr function then supports returning the underlying name
value rather than proxying to the underlying request object.

I also ran into a small bug whereby the del method was triggering
a network request because of some private attributes being accessed
during teardown would trigger the wrapper code. I've overridden
the super class to disable this. Though I'm unclear if this is just the
test suite doing this cleanup.

This commit works around an issue where the basename of the URL many not
actually contain a file extension and the uploader logic cannot infer
the mime type for the file.

We stash the name when pickling and extract it again when unpickling.
The __getattr__ function then supports returning the underlying name
value rather than proxying to the underlying request object.

I also ran into a small bug whereby the __del__ method was triggering
a network request because of some private attributes being accessed
during teardown would trigger the __wrapper__ code. I've overridden
the super class to disable this. Though I'm unclear if this is just the
test suite doing this cleanup.
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