Skip to content

Commit

Permalink
Fix serving local files, fixes #26, #27 (#28)
Browse files Browse the repository at this point in the history
* Fix serving local files, fixes #26, #27

* Reenable file uploads in the frontend
  • Loading branch information
RDMurray authored Feb 29, 2024
1 parent b878ad1 commit 4e503a8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backend/backend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/Forms/ActivityForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ export default class ActivityForm extends React.Component {
<Form.Control
type="file"
accept="image/jpeg, image/jpg, image/png"
disabled={true} // blobbed: disabled image upload
name="image_filename"
value={values.image_filename}
onChange={(event) => {
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/components/Forms/WaypointForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,7 @@ export default class WaypointForm extends React.Component {
<Dropzone
accept={{ 'image/jpeg': ['.jpeg', '.jpg'], 'image/png': ['.png'] }}
maxFiles={MAX_MEDIA_FILES}
// blobbed: disabled image upload
// disabled={this.shouldDisableImageInput(values)}
disabled={true}
disabled={this.shouldDisableImageInput(values)}
onDrop={(acceptedFiles, fileRejections) => {
const totalFiles = values.images.length + values.image_files.length + acceptedFiles.length;
if (totalFiles > MAX_MEDIA_FILES || fileRejections.length > MAX_MEDIA_FILES) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4e503a8

Please sign in to comment.