Commit e5ffd2c6 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

core.vfile: fixed file writing for bytes

parent 4adbae8a
......@@ -257,8 +257,11 @@ def create_versioned_file(filename, file_dir, file_contents):
if isinstance(file_contents, six.string_types):
fdest = VersionedFile(full_path, 'w')
fdest.write(file_contents)
elif isinstance(file_contents, bytes):
fdest = VersionedFile(full_path, 'wb')
fdest.write(file_contents)
elif isinstance(file_contents, (UploadedFile, InMemoryUploadedFile,
TemporaryUploadedFile, SimpleUploadedFile, bytes)):
TemporaryUploadedFile, SimpleUploadedFile)):
fdest = VersionedFile(full_path, 'wb')
for chunk in file_contents.chunks():
fdest.write(chunk)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment