Fixed uploading of images.
Thumbnailing is still broken, though.
This commit is contained in:
parent
aecab0561e
commit
b3b9c68486
@ -712,7 +712,7 @@ def stream_to_storage(project_id):
|
|||||||
elif current_app.config['STORAGE_BACKEND'] == 'local':
|
elif current_app.config['STORAGE_BACKEND'] == 'local':
|
||||||
storage_backend = PillarStorage(project_id)
|
storage_backend = PillarStorage(project_id)
|
||||||
file_in_storage = PillarStorageFile(project_id, internal_fname)
|
file_in_storage = PillarStorageFile(project_id, internal_fname)
|
||||||
file_in_storage.create_from_file(uploaded_file, file_size)
|
file_in_storage.create_from_file(stream_for_gcs, file_size)
|
||||||
|
|
||||||
log.debug('Marking uploaded file id=%s, fname=%s, '
|
log.debug('Marking uploaded file id=%s, fname=%s, '
|
||||||
'size=%i as "queued_for_processing"',
|
'size=%i as "queued_for_processing"',
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -50,7 +52,9 @@ class PillarStorageFile(FileInStorage):
|
|||||||
|
|
||||||
def create_from_file(self, uploaded_file, file_size):
|
def create_from_file(self, uploaded_file, file_size):
|
||||||
# Ensure path exists before saving
|
# Ensure path exists before saving
|
||||||
os.makedirs(os.path.basename(self.path))
|
os.makedirs(os.path.dirname(self.path))
|
||||||
uploaded_file.save(self.path)
|
|
||||||
self.size = file_size
|
|
||||||
|
|
||||||
|
with open(self.path, 'wb') as outfile:
|
||||||
|
shutil.copyfileobj(uploaded_file, outfile)
|
||||||
|
|
||||||
|
self.size = file_size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user