Skip to content

Commit

Permalink
[FILES] Ensure content type is retained when sharing (#1407)
Browse files Browse the repository at this point in the history
* fix lost content type

* fix lint

Co-authored-by: Thibaut Sardan <[email protected]>
  • Loading branch information
FSM1 and Tbaut authored Aug 4, 2021
1 parent bbb7065 commit d4207da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ const CopyToSharedFolderModal = ({ close, file, filePath }: IShareFileProps) =>

setIsUploading(true)

uploadFiles(bucketToUpload.id, [new File([fileContent], file.name)], UPLOAD_PATH, bucketToUpload.encryptionKey)
uploadFiles(
bucketToUpload.id,
[new File([fileContent], file.name, { type: file.content_type })],
UPLOAD_PATH,
bucketToUpload.encryptionKey
)
.then(() => {
if (!keepOriginalFile) {
deleteItems && deleteItems([file.cid], true)
Expand Down
1 change: 1 addition & 0 deletions packages/files-ui/src/Utils/contentTypeGuesser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const guessContentType = (fileName: string) => {
case "pdf":
return "application/pdf"
case "jpg":
case "jpeg":
case "png":
case "gif":
case "bmp":
Expand Down

0 comments on commit d4207da

Please sign in to comment.