From 4e503a894fe1335aa00006c36e21392fe2949cdc Mon Sep 17 00:00:00 2001 From: RDMurray Date: Thu, 29 Feb 2024 20:26:01 +0000 Subject: [PATCH] Fix serving local files, fixes #26, #27 (#28) * Fix serving local files, fixes #26, #27 * Reenable file uploads in the frontend --- backend/backend/urls.py | 2 +- frontend/src/components/Forms/ActivityForm.jsx | 1 - frontend/src/components/Forms/WaypointForm.jsx | 8 ++------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/backend/backend/urls.py b/backend/backend/urls.py index 1ba7842..9f4083e 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -36,7 +36,7 @@ ] # Serve user file uploads -if os.environ.get('ENV') == 'local': +if settings.MEDIA_URL and settings.MEDIA_ROOT : # In a local environment, this is used for storing and serving user file uploads. urlpatterns.extend(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)) else: diff --git a/frontend/src/components/Forms/ActivityForm.jsx b/frontend/src/components/Forms/ActivityForm.jsx index a2802bf..9d940aa 100644 --- a/frontend/src/components/Forms/ActivityForm.jsx +++ b/frontend/src/components/Forms/ActivityForm.jsx @@ -242,7 +242,6 @@ export default class ActivityForm extends React.Component { { diff --git a/frontend/src/components/Forms/WaypointForm.jsx b/frontend/src/components/Forms/WaypointForm.jsx index 3816902..008fd5a 100644 --- a/frontend/src/components/Forms/WaypointForm.jsx +++ b/frontend/src/components/Forms/WaypointForm.jsx @@ -351,9 +351,7 @@ export default class WaypointForm extends React.Component { { const totalFiles = values.images.length + values.image_files.length + acceptedFiles.length; if (totalFiles > MAX_MEDIA_FILES || fileRejections.length > MAX_MEDIA_FILES) { @@ -481,9 +479,7 @@ export default class WaypointForm extends React.Component { 'audio/aac': ['.aac'], }} maxFiles={MAX_MEDIA_FILES} - // blobbed: disabled blob service endpoint - // disabled={this.shouldDisableAudioInput(values)} - disabled={true} + disabled={this.shouldDisableAudioInput(values)} onDrop={(acceptedFiles, fileRejections) => { const totalFiles = values.audio_clips.length + values.audio_clip_files.length + acceptedFiles.length;