Skip to content

Commit

Permalink
Merge a5e80a1 into c1ceb10
Browse files Browse the repository at this point in the history
  • Loading branch information
rclement committed Apr 11, 2018
2 parents c1ceb10 + a5e80a1 commit 32753d9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion flask_fs/backends/gridfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ def read(self, filename):
return f.read()

def write(self, filename, content):
return self.fs.put(self.as_binary(content), filename=filename)
kwargs = {
'filename': filename
}

if hasattr(content, 'content_type'):
kwargs['content_type'] = content.content_type

return self.fs.put(
self.as_binary(content),
**kwargs
)

def delete(self, filename):
regex = '^{0}'.format(re.escape(filename))
Expand Down

0 comments on commit 32753d9

Please sign in to comment.