CenterForOpenScience / waterbutler

WaterButler is a Python web application for interacting with various file storage services via a single RESTful API, developed at Center for Open Science.
Apache License 2.0
62 stars 76 forks source link

[ENG-748] Fix Incorrect Parent Folder For Box Chunked Upload #379

Closed cslzchen closed 5 years ago

cslzchen commented 5 years ago

Ticket

https://openscience.atlassian.net/browse/ENG-748

Purpose

Main

Chunked upload fails to upload the file to the intended folder. Instead, the file ends up in the root folder. During chunked upload session creation, the wrong folder was provided as the parent in the data payload. It should be path.parent.identifier instead of the self.folder. Here is the correct one with contiguous upload and here is the wrong one with chunked upload.

By-product

Correctly handle the mutually exclusiveness between file ID and parent folder ID during chunked upload session creation. During the creation, WB should EITHER provide the path.identifier (file ID) in the URL if the file already exists OR provide the path.parent.identifier (parent folder ID) in the data payload. In addition, providing both will get a 400 with error multiple_destinations. Moreover, providing the parent folder ID when the file exists will get a 409 with error item_name_in_use. Finally, chunked upload never asks user to confirm file conflicts and just overwrites.

Out-of-scope

Changes

Main

Use path.parent.identifier instead of the self.folder.

By-product

Only add folder_id to payload data when path.identifier is None.

Side effects

No

QA Notes

Please refer to the QA Notes section in the ticket.

Deployment Notes

No

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.003%) to 91.827% when pulling a784a2d708969efee38aac4aca691da598c6cd4b on cslzchen:fix/box-chunked-upload into cadf98d5317081d2d0673df78b23a40551bab8ba on CenterForOpenScience:master.

felliott commented 5 years ago

This has been merged as a hotfix into master, but GH didn't pick up on that when I retargeted the PR to master. I tried switching to develop and back to master, but it won't let me since the commits are already in master. Confusing. Anyway, this has been merged!

felliott commented 5 years ago

Gonna try re-opening and reclosing to trigger a travis build.

felliott commented 5 years ago

Nope! That didn't work at all!