Resolves T4622
Details
- Reviewers
lunar ardumont - Group Reviewers
Reviewers - Maniphest Tasks
- Restricted Maniphest Task
- Commits
- rDDEPe0d553df6ffe: Raise 400 instead of 500 on 'incomplete' multipart request
Diff Detail
- Repository
- rDDEP Push deposit
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Build is green
Patch application report for D8664 (id=31287)
Rebasing onto 730e81d8dd...
First, rewinding head to replay your work on top of it... Applying: Raise 400 instead of 500 on 'incomplete' multipart request
Changes applied before test
commit 5d2053f048d3fdb9729f411ab0bbd40924c81e41 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Oct 12 10:19:30 2022 +0200 Raise 400 instead of 500 on 'incomplete' multipart request
See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/865/ for more details.
swh/deposit/api/common.py | ||
---|---|---|
561–570 | This check feels redundant at this point and I’m not sure it’s adding value to users but there’s no harm either. | |
590 | After reading the documentation, it’s unclear to me why the previous error (raised for providing more than one archive or definition) raised ERROR_CONTENT and this one raises BAD_REQUEST. Quoting the definition :
I feel ERROR_CONTENT is probably the right one in all these cases. | |
631–632 | As you are now raising an exception if filehandler is None at the beginning, I guess this assert could be removed. |
swh/deposit/api/common.py | ||
---|---|---|
590 |
Reasons... have been lost to the ages... Although, I do recall a tedious deposit beginning so technical decisions [1] were made so it actually lands and gets deployed. [1] 1 "multipart" request with actually one tarball (archive) and one xml file (metadata). If more or less ~> 400.
In this context, that's probably a technical issue with the provided file. |
swh/deposit/api/common.py | ||
---|---|---|
590 | I am quite confused by your answer. I am not sure it matters regarding the actual error code, but as far as I can understand, the SWORDv2 spec mandates that there is only two parts in this case:
Was there a time where swh-deposit behaved differently? |
swh/deposit/api/common.py | ||
---|---|---|
590 | I'm also getting confused and it feels like we're getting trapped in a loop.
Tentatively trying to break the cycle (maybe? ;p). That quotes replies it better than i did then. Are you asking for us to align the error to be the same in both conditional (in the
It's possible that at an early stage, plenty of issues regarding those steps were not |
rebase + remove redundant assertion
swh/deposit/api/common.py | ||
---|---|---|
590 | The two errors added by this diff are caused by expected types being missing. ERROR_CONTENT is when receiving content with unexpected types. Because multipart requests can have arbitrarily many contents, one does not imply the other (even though they are correlated) | |
631–632 | indeed |
Build is green
Patch application report for D8664 (id=31401)
Rebasing onto 730e81d8dd...
Current branch diff-target is up to date.
Changes applied before test
commit af718a5dcb5083b16bc030bb9f4821adfabba9fc Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Oct 12 10:19:30 2022 +0200 Raise 400 instead of 500 on 'incomplete' multipart request
See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/866/ for more details.
Build is green
Patch application report for D8664 (id=31663)
Rebasing onto 9f8535874d...
Current branch diff-target is up to date.
Changes applied before test
commit e0d553df6ffeb5bbcf5c844a3c1836fc84941092 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Wed Oct 12 10:19:30 2022 +0200 Raise 400 instead of 500 on 'incomplete' multipart request
See https://jenkins.softwareheritage.org/job/DDEP/job/tests-on-diff/869/ for more details.