xdevplatform/twitter-ruby-ads-sdk

Previewing a status with spaces in it results in %20 in the rendered preview

Closed this issue ยท 7 comments

Issue Type: Bug

Description: When sending status text containing spaces to the API for a preview, the rendered preview contains %20s instead of spaces. In #67, I provided a code change to stop this, but learned that the bug was actually in the API. @brandonblack reported that the bug has been fixed, but I'm still observing the same problem.

Expected Result:
"test test" is previewed as "test test"

Actual Result:
"test%20test" is previewed.

Steps to Reproduce:

  • Send a string with spaces to the preview API.
  • Observe the rendered preview.

Relates To: #67

Thanks for reporting @scottmartinnet. Let me check in again with the team that owns this service and confirm.

hwz commented

This API-related issue is now fixed

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

Fix confirmed from our end.

There appears to have been a regression here: the API is now rendering %20 again when this code is called with spaces.

@scottmartinnet Sorry to request you to do one more step - but do you mind posting this to https://twittercommunity.com/c/advertiser-api with repro steps so one of the team members can pick it up and look at it? (There are several people monitoring that forum for this sort of bug report)

Happy to, but I'm not 100% clear on whether this is a bug in the client or in the API itself. The client code URI-escapes the input before sending it, which seems to clearly be the cause of this issue. Removing that line stops the problem. But the fix here was originally a change to the API, leaving the URI-escaping in place. I had successfully tested the current client code (with URI-escaping) against the API after that fix.

If I filed a ticket with the API itself, it would say that sending URI-escaped text as a value renders that text as its URI-escaped value, which (naively) seems to be the right behavior.