Skip to content

Commit

Permalink
Merge pull request #19 from richardvanbergen:fix/mime-types
Browse files Browse the repository at this point in the history
Missing mime-type not uploading resized images
  • Loading branch information
richardvanbergen authored Aug 10, 2021
2 parents e732176 + 9cf39a1 commit cdcc3e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "payload-plugin-cloud-storage",
"version": "1.0.2",
"version": "1.0.3",
"description": "Remote storage plugin for Payload CMS.",
"main": "dist/index.js",
"author": {
Expand Down
7 changes: 4 additions & 3 deletions src/collection/uploadHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ const uploadHook = (adapter: AdapterInterface) => {
? Object.keys(req.payloadUploadSizes)
.map(uploadSize => {
const name = data?.sizes?.[uploadSize]?.filename
const mimeType = data?.sizes?.[uploadSize]?.mimeType
const mimetype = uploadedFile?.mimetype
const buffer = req?.payloadUploadSizes?.[uploadSize]
if (name && mimeType && buffer) {

if (name && mimetype && buffer) {
return adapter.upload({
name,
data: buffer,
mimetype: mimeType
mimetype: mimetype
})
}
})
Expand Down

0 comments on commit cdcc3e5

Please sign in to comment.