Fix uploads accelerated by Workhorse not working with paths [RUN ALL RSPEC] [RUN AS-IF-FOSS]
Filenames with slashes were allowed before we added Workhorse acceleration in the uploads API via !57250 (merged). However, users have scripted their uploads to use paths, and Workhorse now rejects files outright with slashes.
To accommodate this, we now extract the base of the filename so that file
uploads with paths can still work. We introduce the feature flag
workhorse_extract_filename_base
to roll this change out.
Relates to #326350 (closed)
Testing
With curl
, you can modify the form filename by adding the ;filename
parameter. For example:
curl -v -X POST -H "PRIVATE-TOKEN: REDACTED-TOKEN" https://localhost:3000/api/v4/projects/first%2Fsecond%2Ftest/uploads --form "file=@/tmp/job.log;filename=test/bad/job.log"
Edited by Stan Hu