Unable to parse S3 Key with prefix under Thumbor mode
example:
-
URL that could be parsed correctly: https://xxxxx.cloudfront.net/fit-in/400x400/filters:watermark(test,random.jpg,0,0)/lena.jpg
-
URL that couldn't be parsed: https://xxxxx.cloudfront.net/fit-in/400x400/filters:watermark(test,test/random.jpg,0,0)/lena.jpg be
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 Thanks for contacting us, and thanks for your feedback. We'll investigate this issue and get back to you.
Thanks @beomseoklee , any update?
@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.
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,
Looking forward for your update, thanks!
Thanks for waiting @salander0411 We've fixed this issue in v5.1.0.