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

dropbox backend does not overwrite existing files #138

Closed
epetxepe opened this issue Apr 7, 2016 · 3 comments
Closed

dropbox backend does not overwrite existing files #138

epetxepe opened this issue Apr 7, 2016 · 3 comments
Labels

Comments

@epetxepe
Copy link

epetxepe commented Apr 7, 2016

This backend has no similar option to "file_overwrite = setting('AWS_S3_FILE_OVERWRITE', True)" as S3boto does.

I've overcome this issue by updating _save method with solution at http://stackoverflow.com/questions/31909627/dropbox-files-not-being-overwritten

def _save(self, name, content):
        #name = name.replace ('\\','/')     #137 
        file_metadata = self.client.metadata(name)
        the_rev = file_metadata['rev']
        self.client.put_file(name, content, overwrite=True, parent_rev=the_rev)
        return name

I think it would be interesting to add something similar for this backend

@jschneier
Copy link
Owner

Sure! Would you be interesting in creating a pull request for this functionality?

Also, from that Stackoverflow link it looks like dropbox will ignore the write if the content is the same. I don't think it's that important for now but something to keep in mind.

epetxepe added a commit to epetxepe/django-storages that referenced this issue Apr 12, 2016
- jschneier#137 I've placed everything on the _save function given that "get_available_name" was not being called when file is written with open () method.
- jschneier#138 No file_overwrite variable is considered. Overwrite is forced, if the file has the same content, dropbox keeps the previous one so no overwrite is reflected.
@riccardodivirgilio
Copy link

+1

@jschneier
Copy link
Owner

Fixed in #873.

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

No branches or pull requests

4 participants