Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata and Content-Disposition #38

Open
KevinLu opened this issue Jun 1, 2020 · 10 comments
Open

Metadata and Content-Disposition #38

KevinLu opened this issue Jun 1, 2020 · 10 comments

Comments

@KevinLu
Copy link

KevinLu commented Jun 1, 2020

Will this library support Metadata and Content-Disposition?

I've tried adding Content-Disposition like this:

var upload = multer({
    storage: multerS3({
        s3: s3,
        Bucket: s3Bucket,
        ContentType: multerS3.AUTO_CONTENT_TYPE,
        ContentDisposition: 'attachment',
        Key: (req, file, cb) => {
            cb(null, file.originalname);
        }
    }),
    fileFilter: mediaFilter
});

but in my S3 bucket, the metadata Content-Disposition does not get added.

S3 Upload Property has Content-Disposition as one of its properties.

Looking forward to this.

@rramiachraf
Copy link

How did you guys used the AUTO_CONTENT_TYPE from 'multer-s3', i can't get it done correctly, ContentType is throwing a typescript error and when i silence it, it throws this error "Expected params.ContentType to be a string"

@KevinLu
Copy link
Author

KevinLu commented Dec 24, 2020

How did you guys used the AUTO_CONTENT_TYPE from 'multer-s3', i can't get it done correctly, ContentType is throwing a typescript error and when i silence it, it throws this error "Expected params.ContentType to be a string"

Sorry, when I tested this further. I got the same error as you. AUTO_CONTENT_TYPE is not implemented in multer-sharp-s3 so there's no hope of getting that working. Did you ever find a fix for this?

@rramiachraf
Copy link

rramiachraf commented Dec 25, 2020

Unfortunately not, I just abandoned both of multer-s3 and multer-sharp-s3 and I just used raw aws-sdk with sharp and it's even better.

@KevinLu
Copy link
Author

KevinLu commented Dec 27, 2020

Unfortunately not, I just abandoned both of multer-s3 and multer-sharp-s3 and I just used raw aws-sdk with sharp and it's even better.

Yup, that's what I did do. AWS sdk on its own with Sharp seems to work a lot better.

@ikhsanalatsary
Copy link
Owner

Hi @KevinLu, thanks for addressing this issue. for contentType, this lib has a default value if you don't specify it will check based on your file type. for the ContentDisposition, this lib not supported it yet. I will check if I have spare time.

@KevinLu
Copy link
Author

KevinLu commented Feb 8, 2021

Hi @KevinLu, thanks for addressing this issue. for contentType, this lib has a default value if you don't specify it will check based on your file type. for the ContentDisposition, this lib not supported it yet. I will check if I have spare time.

Thanks for the response, let me know if you've gotten it sorted out. I'd love to give this package another try.

@ozgrozer
Copy link

@rramiachraf @KevinLu Can you guys share an example code? I'd like to go with aws-sdk and sharp too. Since this package is not maintained anymore.

@rramiachraf
Copy link

@ozgrozer here you go man, https://github.com/rramiachraf/buffalo/blob/main/backend/src/rest/updatePoster.ts

@ozgrozer
Copy link

ozgrozer commented Nov 25, 2021

@rramiachraf Thank you for the code. It helped me a lot.

I also made a clean version of it and posted to Stack Overflow. Thought it might help other people who are struggling with the same issue.

https://stackoverflow.com/a/70114704/1340552

@ikhsanalatsary
Copy link
Owner

Thank you for addressing this issue. I think there's a missing in this lib 😃 . If you don't mind and can fix this. PR is always welcome. FYI, I just published v.0.2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants