Fix: keep source=import signal alive across chunked media uploads#334
Open
level09 wants to merge 2 commits into
Open
Fix: keep source=import signal alive across chunked media uploads#334level09 wants to merge 2 commits into
level09 wants to merge 2 commits into
Conversation
…oads PR #312 replaced the referrer-based import_upload detection with a form field check. Dropzone drops its 'params' option on chunked POSTs, so request.form.get('source') returns None on every chunk, import_upload is False, and in S3 mode the chunk endpoint pushes uploads to S3 then removes the local copy. ETL then has nothing to read locally and every import fails with 'The filename given was either non existent or was a directory'. Move the signal to the URL query string. It rides along on every chunk POST regardless of how Dropzone shapes the body, with the same security posture as the form-body check (the admin role gate three lines down is the actual access control).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
apodacaduron
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #312 replaced the
request.referrercheck on/admin/api/media/chunkwithrequest.form.get(\"source\") == \"import\". Dropzone drops itsparamsoption on chunked POSTs, so the form field is missing on every chunk request,import_uploadis alwaysFalse, and in S3 mode the chunk endpoint takes the S3 push + local delete branch. The import ETL then runs and finds no local file:Every import in S3 mode has been failing since #312 merged.
Fix
Move
source=importfrom Dropzone'sparamsto the URL query string and checkrequest.argsinstead ofrequest.form. Query params live on the URL and ride along on every chunk POST regardless of how Dropzone shapes the body.Same security posture as the form-body check — both come from the client. The actual access control is the
current_user.has_role(\"Admin\")gate three lines down, which is unchanged.Test plan
FILESYSTEM_LOCAL=False. Confirm the file lands inenferno/media/locally for ETL, then ends up in S3 afterMediaImport.upload().FILESYSTEM_LOCAL=True. Confirm normal local-only behavior still works./admin/api/media/chunk?source=importdirectly (admin role gate still applies).