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

Add failing test which tries to save the same content twice #371

Merged

Conversation

melwas
Copy link
Contributor

@melwas melwas commented Jul 28, 2017

See: #367

@jschneier This is the failing tests.

With a new implementation Django saves intermediate files, so you can have two files with the same content but with different names (here is the closed issue on Django Issue Tracker).

You can see it hereself._save is called twice with the same content but with different names (it is not visible at first because hashed_name is recalculated just before save).

Django-Storages' code assumes that the content wasn't read before, but it is not the case with new Django's implementation. File content is already read, so the second read returns an empty bytes array.

I believe that django-storages should not make any assumptions regarding whether the file has been read before or not, and always seek(0) before reading.

What do you think?

@jschneier jschneier merged commit c7d1000 into jschneier:master Jul 31, 2017
This was referenced Aug 1, 2017
nitely pushed a commit to satellogic/django-storages that referenced this pull request Jul 30, 2018
nitely pushed a commit to satellogic/django-storages that referenced this pull request Jul 30, 2018
nitely pushed a commit to satellogic/django-storages that referenced this pull request Jul 30, 2018
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