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

Unable to parse S3 Key with prefix under Thumbor mode #231

Closed
salander0411 opened this issue Aug 21, 2020 · 6 comments
Closed

Unable to parse S3 Key with prefix under Thumbor mode #231

salander0411 opened this issue Aug 21, 2020 · 6 comments

Comments

@salander0411
Copy link

salander0411 commented Aug 21, 2020

example:

That looks like is due to

        if (requestType === "Thumbor" || requestType === "Custom") {
            return decodeURIComponent(event["path"].replace(/\d+x\d+\/|filters[:-][^/;]+|\/fit-in\/+|^\/+/g,'').replace(/^\/+/,''));
        }

the regex will lead the key to be 'random.jpg,0,0)/lena.jpg '

in parseImageKey in image-request.js

@salander0411 salander0411 changed the title Unable to parse S3 Key under Thumbor mode Unable to parse S3 Key with prefix under Thumbor mode Aug 21, 2020
@beomseoklee
Copy link
Member

@salander0411 Thanks for contacting us, and thanks for your feedback. We'll investigate this issue and get back to you.

@salander0411
Copy link
Author

Thanks @beomseoklee , any update?

@beomseoklee
Copy link
Member

beomseoklee commented Aug 25, 2020

@salander0411 I think this would work. Not fully tested though.

\d+x\d+\/|filters:.+(.?\))|\/fit-in\/+|^\/+

So maybe the source code you provided can be replaced to

        if (requestType === "Thumbor" || requestType === "Custom") {
            return decodeURIComponent(event["path"].replace(/\d+x\d+\/|filters:.+(.?\))|\/fit-in\/+|^\/+/g,'').replace(/^\/+/,''));
        }

I'm still testing it.

@salander0411
Copy link
Author

The key could be parsed correctly but the overlay image key cannot be parsed now.

https://xxxxx.cloudfront.net/fit-in/400x400/filters:watermark(test,random.jpg,0,0)/lena.jpg

orginal image could be parsed to be: https://xxxxx.cloudfront.net/lena.jpg

but the overlay image key now parsed to be : filters:watermark(oss-to-s3-test,

@salander0411
Copy link
Author

Looking forward for your update, thanks!

@beomseoklee
Copy link
Member

Thanks for waiting @salander0411
We've fixed this issue in v5.1.0.

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

3 participants