diff --git a/gracedb/core/vfile.py b/gracedb/core/vfile.py index c5ae8abe895ba89f6febf08b645486f282d054a8..a362993b9b701ee9e9c248d23dce9e8f380644de 100644 --- a/gracedb/core/vfile.py +++ b/gracedb/core/vfile.py @@ -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)