Copy FileHandle Object
Use case
- PLFM-3672Getting issue details... STATUS
Project organizer set a rule of how files should be uploaded to the project. However, contributors doesn't follow the rule. This results in files uploaded in a wrong format and previews are not generated. Project organizer needs a way to change the file name, file content type, and the preview of the FileEntity in Synapse. The current work around is downloading the file from Synapse, change the file content type, and then re-upload the file as a new version of a file entity.
The current solution for changing the file name does not work for files that are not file entity: - PLFM-3457Getting issue details... STATUS
Proposal
Give users a new API that allows them to make a copy of a FileHandle object:
Action | Intended User | URI | Method | Request Params | Request Body | Response Body |
---|---|---|---|---|---|---|
Make a copy of a FileHandle | anyone who has download permission on the FileHandle | /filehandles/copy | POST | BatchFileHandleCopyRequest | BatchFileHandleCopyResult |
BatchFileHandleCopyRequest |
---|
fileHandleCopyRequests: List<FileHandleCopyRequest> |
BatchFileHandleCopyResult |
---|
fileHandleCopyResults: List<FileHandleCopyResult> |
FileHandleCopyRequest |
---|
fileHandleAssociation: FileHandleAssociation |
newFileName: String |
newContentType: String |
FileHandleCopyResult |
---|
errorCode: Enum [NotFound, Unauthorized] |
newFileHandle: FileHandle |
originalFileHandleId: String |
Batch size limit: 100.
After the user create a copy of the original FileHandle with the new name and content type, they can then use the new FileHandle to update their FileEntity.
Copy FileHandle Audit Record
For each file included in the results, an audit record will capture the following data:
- OriginalFileHandleId
- OriginalAssociatedObjectId
- OriginalAssociatedObjectType
- UserId
- Timestamp
- NewFileHandleId
Related Issues:
- Change how user gets presign URL work to always use the FileHandle's fileName and contentType.
- Deprecate Entity's overrideName field.