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

Cannot render images without file extensions #188

Closed
ianjamieson opened this issue Feb 19, 2020 · 8 comments
Closed

Cannot render images without file extensions #188

ianjamieson opened this issue Feb 19, 2020 · 8 comments

Comments

@ianjamieson
Copy link

I am using version 4.2 with no modifications.

Given an image in S3:

https://bucket.s3-region.amazonaws.com/imageWithNoExtension

I cannot access this image in via cloudfront: https://uniqueId.cloudfront.net/imageWithNoExtension

I get the error:

{
"status": 400,
"code": "DecodeRequest::CannotDecodeRequest",
"message": "The image request you provided could not be decoded. Please check that your request is base64 encoded properly and refer to the documentation for additional guidance."
}

Also, I cannot use the Thumbor style syntax to resize this image: https://uniqueId.cloudfront.net/fit-in/100x100/imageWithNoExtension

I get this error:

{
"status": 400,
"code": "RequestTypeError",
"message": "The type of request you are making could not be processed. Please ensure that your original image is of a supported file type (jpg, png, tiff, webp) and that your image request is provided in the correct syntax. Refer to the documentation for additional guidance on forming image requests."
}

When you parseRequestType, matchDefault.test(path) is true:

https://github.com/awslabs/serverless-image-handler/blob/19cbc3ce759d7c8d8ddc35081972d7ac1daf0c71/source/image-handler/image-request.js#L207-L233

And subsequently when attempting to decodeRequest:

https://github.com/awslabs/serverless-image-handler/blob/19cbc3ce759d7c8d8ddc35081972d7ac1daf0c71/source/image-handler/image-request.js#L242-L255

That try block fails and throws the error.

What I am hoping to achieve is that if my file exists (without a file extension) in S3 then we can still serve that image via cloudfront.

@beomseoklee
Copy link
Member

Hi @ianjamieson , and thanks for contacting us.
It might be related to #169 as well, so we would think about it.

@ianjamieson
Copy link
Author

Hey @beomseoklee - yeh it looks similar, I have subscribed to the other thread.

@Karlen92
Copy link

Karlen92 commented Feb 28, 2020

I made this for me from latest version. It handles files without extensions.
https://round2-ohio-us-1.s3.us-east-2.amazonaws.com/Archive.zip
You can try and see if it works for you. It's based on 4.2 version

@ianjamieson
Copy link
Author

@Karlen92 - that's great thank you. Are there significant changes? How about making a PR on this repo or forking this repo?

@Karlen92
Copy link

@ianjamieson changes are a few lines, but I believe in the latest version now it's fixed

@ianjamieson
Copy link
Author

Thanks @Karlen92

@bayareahank
Copy link

Ran into this bug as of release 5.1, still not fixed.

@G-Lenz
Copy link
Contributor

G-Lenz commented Jan 29, 2021

We've added limited support for files without extensions in v5.2.0. Any image filters that use Amazon Rekognition (content moderation and smart cropping) will not work with files that do not have an extension.

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

6 participants