Closed (fixed)
Project:
Drupal core
Version:
11.x-dev
Component:
file system
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2023 at 22:46 UTC
Updated:
18 Jan 2024 at 23:51 UTC
Jump to comment: Most recent
In #3221796: [META] Modernise file upload logic we identified a common need for REST and JSON API file uploads is to stream uploads from php://input.
Let's create a service to handle that.
A new InputStreamFileWriter service is available for writing the input stream to a temporary file.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
kim.pepperRemaining tasks:
Create a StreamFileUploaderComment #3
kim.pepperComment #5
kim.pepperComment #6
kim.pepperA couple of remaining tasks:
Comment #7
kim.pepperAdded a change record. There is nothing to deprecate as we are just replacing usage in protected methods.
Comment #8
smustgrave commentedChange looks good. Updated CR to include the name of the new service.
Comment #9
quietone commentedI'm triaging RTBC issues. I read the IS, the comments and the comments in the MR. I didn't find any unanswered questions or other work to do.
Leaving at RTBC.
Comment #10
kim.pepperWorking through all the issues under #3221796: [META] Modernise file upload logic the name "uploader" is a very over-used term. Using it here "StreamFileUploader" is a bit confusing. I think
InputStreamFileWriter::writeStreamToFile()is a much clearer name to describe what it does.Updated the code, issue title & summary and change record to match.
Comment #11
kim.pepperBlocking a critical #2940383: [META] Unify file upload logic of REST and JSON:API therefore this is also critical.
Comment #12
quietone commented@kim.pepper, thanks for not adding more instances of the word 'uploaders'. That word is in dictionary.txt and we are trying to remove all the misspellings from that file.
Comment #13
larowlanThis needs a reroll.
Conceptually it looks like a great cleanup, duplicated code from the two modules is consolidated. This probably should have happened before JSON:API went into core, but better late than never.
Comment #14
kim.pepperRe-rolled.
Comment #15
larowlanLeft some comments on the MR
Comment #16
kim.pepperResolved feedback.
Comment #17
smustgrave commentedBummer about missing 10.2 but feedback appears to have been addressed.
Comment #19
larowlanCommitted to 11.x and published the change record.
Thanks!
Comment #22
kim.pepperWe forgot to update the CR links in the deprecation trigger. Created #3415422: Fix incorrect change record link in FileUploadResource and TemporaryJsonapiFileFieldUploader constructors
Comment #23
kim.pepperCreated another follow up for deprecating
BYTES_TO_READ#3415706: Deprecate unused constant BYTES_TO_READ in FileUploadResource and TemporaryJsonapiFileFieldUploader