Jul 14 - Using CDN - Phase 1
This commit is contained in:
@@ -58,11 +58,10 @@ def _save_photo(file_obj, subfolder='inspection_photos'):
|
||||
file_obj.seek(0)
|
||||
if not any(header.startswith(m) for m in _IMAGE_MAGIC):
|
||||
return None
|
||||
filename = f"{uuid.uuid4().hex}.{ext}"
|
||||
dest_dir = os.path.join(current_app.config['UPLOAD_FOLDER'], subfolder)
|
||||
os.makedirs(dest_dir, exist_ok=True)
|
||||
file_obj.save(os.path.join(dest_dir, filename))
|
||||
return f"uploads/{subfolder}/{filename}"
|
||||
# Write via the active storage backend (local disk or R2). Key format
|
||||
# 'uploads/<subfolder>/<uuid>.<ext>' is unchanged across backends.
|
||||
from app.utils import storage
|
||||
return storage.save(file_obj, subfolder)
|
||||
|
||||
|
||||
def _collect_form_responses(form_fields, existing_responses=None):
|
||||
|
||||
Reference in New Issue
Block a user