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

URL encode pathSid in UserFetcher.fetch() #556

Closed
dkorz opened this issue Jul 6, 2020 · 1 comment
Closed

URL encode pathSid in UserFetcher.fetch() #556

dkorz opened this issue Jul 6, 2020 · 1 comment
Labels
status: ready for deploy code ready to be released in next deploy type: bug bug in the library

Comments

@dkorz
Copy link

dkorz commented Jul 6, 2020

Issue Summary

The SID parameter for fetching a user in com.twilio.rest.chat.v2.service.UserFetcher.fetch may be the user's SID or identity. If it's an identity it may contain characters illegal for the URL.

Steps to Reproduce

  1. Create a chat user with identity "a|b".
  2. User.fetcher(serviceSid, "a|b").fetch()

Code Snippet

User.fetcher(serviceSid, "a|b").fetch()

This will throw an

Exception/Log

Caused by: com.twilio.exception.ApiException: Bad URI: https://chat.twilio.com/v2/Services/IS0f052bab32f947aeb5ccb42bb0f73b28/Users/a|b
	at com.twilio.http.Request.constructURL(Request.java:143)
	at com.twilio.http.NetworkHttpClient.makeRequest(NetworkHttpClient.java:106)
	at com.twilio.http.HttpClient.reliableRequest(HttpClient.java:42)
	at com.twilio.http.HttpClient.reliableRequest(HttpClient.java:25)
	at com.twilio.http.TwilioRestClient.request(TwilioRestClient.java:50)
	at com.twilio.rest.chat.v2.service.UserFetcher.fetch(UserFetcher.java:51)
	at com.twilio.rest.chat.v2.service.UserFetcher.fetch(UserFetcher.java:20)
	at com.twilio.base.Fetcher.fetch(Fetcher.java:45)
	at io.yolabs.services.twilioservice.TwilioApi.getUser(TwilioApi.kt:135)
	... 1 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 82: https://chat.twilio.com/v2/Services/IS0f052bab32f947aeb5ccb42bb0f73b28/Users/a|b
	at java.base/java.net.URI$Parser.fail(URI.java:2913)
	at java.base/java.net.URI$Parser.checkChars(URI.java:3084)
	at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3166)
	at java.base/java.net.URI$Parser.parse(URI.java:3114)
	at java.base/java.net.URI.<init>(URI.java:600)
	at com.twilio.http.Request.constructURL(Request.java:140)
	... 9 more

Technical details:

  • twilio-java version: 7.52.0
  • java version: 8
@eshanholtz
Copy link
Contributor

Fixed by #558

@eshanholtz eshanholtz added status: ready for deploy code ready to be released in next deploy type: bug bug in the library labels Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready for deploy code ready to be released in next deploy type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants