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

Fix parsing of already-decoded URIs #310

Open
zikolach opened this issue Oct 18, 2023 · 0 comments
Open

Fix parsing of already-decoded URIs #310

zikolach opened this issue Oct 18, 2023 · 0 comments

Comments

@zikolach
Copy link

I have issue with UriInterpolator attempting to decode part of URL which which is not originally encoded (just contains % character) or was already decoded.

Sample URL
https://storage.googleapis.com/realtyplusmag-news-photo/news-photo/108462.Welspun-Set-To-Acquire-70%-Debt-Of-Sintex-BAPL-2.jpg

Stack trace

URLDecoder: Illegal hex characters in escape (%) pattern - negative value
java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - negative value
	at sttp.model.internal.Rfc3986$.decode(Rfc3986.scala:76)
	at sttp.model.UriInterpolator$UriBuilder$.sttp$model$UriInterpolator$UriBuilder$$decode(UriInterpolator.scala:665)
	at sttp.model.UriInterpolator$UriBuilder$.$anonfun$tokensToStringSeq$5(UriInterpolator.scala:620)
	at scala.collection.StrictOptimizedIterableOps.flatMap(StrictOptimizedIterableOps.scala:118)
	at scala.collection.StrictOptimizedIterableOps.flatMap$(StrictOptimizedIterableOps.scala:105)
	at scala.collection.immutable.Vector.flatMap(Vector.scala:113)
	at sttp.model.UriInterpolator$UriBuilder$.doToSeq$1(UriInterpolator.scala:618)
	at sttp.model.UriInterpolator$UriBuilder$.sttp$model$UriInterpolator$UriBuilder$$tokensToStringSeq(UriInterpolator.scala:632)
	at sttp.model.UriInterpolator$UriBuilder$Path$.pathFromTokens(UriInterpolator.scala:479)
	at sttp.model.UriInterpolator$UriBuilder$Path$.$anonfun$fromTokens$1(UriInterpolator.scala:475)
	at sttp.model.UriInterpolator$UriBuilder$.sttp$model$UriInterpolator$UriBuilder$$fromStartingToken(UriInterpolator.scala:565)
	at sttp.model.UriInterpolator$UriBuilder$Path$.fromTokens(UriInterpolator.scala:475)
	at sttp.model.UriInterpolator$.$anonfun$interpolate$1(UriInterpolator.scala:57)
	at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183)
	at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179)
	at scala.collection.immutable.List.foldLeft(List.scala:79)
	at sttp.model.UriInterpolator$.interpolate(UriInterpolator.scala:56)
	at sttp.model.UriInterpolator$UriContext.uri(UriInterpolator.scala:36)

Originally posted by @zikolach in #257 (comment)

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

1 participant