Closed eboto closed 3 years ago
Hmm, interesting. I'll take a look at this. Thanks for the thorough report, @eboto!
I haven't been able to replicate this problem @eboto. I set up a test image at https://paulstraw.imgix.net/colon:test/benice.jpg. When I use URLHelper#getURL
providing either colon:test/benice.jpg
or colon%3Atest/benice.jpg
, the output matches the input. Would it be possible for you to provide a code snippet I can use to replicate this?
Hm ok maybe my steps to repro weren't great. Here are sample URLs that demonstrate it.
This is the scala code I used to generate the 2 signed URLs:
import com.imgix.URLBuilder
val queryParams = new java.util.HashMap[String, String]
queryParams.put("w", "50")
queryParams.put("h", "50")
queryParams.put("fit", "crop")
val url = "https://dfxmachina-dev.s3.amazonaws.com/suZ32nz0XTTOTlVaoGCr6752126306682600695.jpg?response-cache-control=max-age%3D86400&response-content-disposition=inline&x-amz-security-token=FQoDYXdzEGsaDFZn9nWWulUR50%2Fz7SLvAaZDerJCxxUiRiKAids6d%2B5OU%2BWaBzGyxnO0u47bB5aj8MfTtwQBTZPATN0v908sJ6R6aIXVRzhPO%2BMs%2FtDDZ7eFIJg%2BfL7d6%2F0%2B9o%2FsvR68TSTaubNjj%2FhTRMZCB0s3sFsl1klyxoQgmidm%2B53j0D9gSIfHaDW9lof7Z%2FbNSyuSjxx%2FbZxksA8hWaYna172XO027OG11u4PfW0ZQ%2BgeeYTPN9YaI15OKEfO0VRgGoYpEqET145PYXBw6Obr0gOtQSdRbsBFoifpHWuL3eSCESb3LjIomcJHVsJIfAg5D99zixaLzPVbD0unT7ir1XIqKOfUm7wF&AWSAccessKeyId=ASIAIRCLC2OECGERAPDQ&Expires=1468540799&Signature=8fUZk%2FoDu%2FWyQD2gTt6OrawZf%2BY%3D"
val builder = new URLBuilder("instrumental-dev.imgix.net")
builder.setUseHttps(true)
builder.setSignKey("signing key here")
println("v--- This URL is broken")
println(builder.createURL(url, queryParams))
println("v--- This URL works")
println(builder.createURL(java.net.URLEncoder.encode(url, "UTF-8"), queryParams))
Oh, I think I misunderstood before. This is happening when you try to generate a URL for a web proxy source, using the complete URL of the destination image, correct?
Yes that's right!
On Jul 14, 2016 5:06 PM, "Paul Straw" notifications@github.com wrote:
Oh, I think I misunderstood before. This is happening when you try to generate a URL for a web proxy source, using the complete URL of the destination image, correct?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/imgix/imgix-java/issues/14#issuecomment-232826950, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPReTCOBngPWk0C1teiAxwgOlbT8Vspks5qVs7mgaJpZM4JIdB5 .
@eboto, does usage like https://github.com/imgix/imgix-java/commit/dd3905dd67847679f46779708fad21fec76327fe (passing an unencoded URL) work as expected?
Hey @eboto, just wanted to check in if you'd had a chance to test my suggestion from the previous comment on July 20th!
Hey @eboto, PRs #68 is & #70 should address this issue. Thanks for reporting this, and please feel free to open this again if we missed anything.
Unlike the javascript API, the java API forces you to double url-encode the source URL path provided to createURL.
Steps to reproduce:
https://my.domain/project:1/blah.jpg
https://my.domain/project%3A1/blah.jpg
HTTPBuilder.createURL
to create an imgix URL against your imgix domain.builder.createURL(java.net.URLEncoder.encode("https://my.domain/project%30A1/blah.jpg", "UTF-8"), params)
Expected behavior:
createURL
and get a valid imgix URL out.