-
-
Notifications
You must be signed in to change notification settings - Fork 866
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
jschneier
merged 1 commit into
jschneier:master
from
melwas:bugfix/issue-367-saving-same-content-twice
Jul 31, 2017
Merged
Add failing test which tries to save the same content twice #371
jschneier
merged 1 commit into
jschneier:master
from
melwas:bugfix/issue-367-saving-same-content-twice
Jul 31, 2017
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Aug 1, 2017
This was referenced Aug 1, 2017
jschneier
pushed a commit
that referenced
this pull request
Aug 14, 2017
jschneier
pushed a commit
that referenced
this pull request
Aug 14, 2017
This was referenced Aug 14, 2017
This was referenced Aug 21, 2017
This was referenced Oct 2, 2017
This was referenced Nov 10, 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 here —
self._save
is called twice with the same content but with different names (it is not visible at first becausehashed_name
is recalculated just beforesave
).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?