flowdock / oulu

Flowdock IRC Gateway
MIT License
76 stars 16 forks source link

Spaces in shared URLS/uploaded files not converted to %20 #60

Open devkev opened 9 years ago

devkev commented 9 years ago

When files are uploaded to a flow, the URL sent via IRC isn't properly URL-encoded. Specifically, spaces aren't converted to %20. This gives things like this:

<RandomPerson> https://www.flowdock.com/rest/files/81438/n3ISn0DBwkVhTkTYGm_nQQ/Screenshot 2015-01-15 13.26.33.png

which are unclickable in most IRC clients. It should instead be

<RandomPerson> https://www.flowdock.com/rest/files/81438/n3ISn0DBwkVhTkTYGm_nQQ/Screenshot%202015-01-15%2013.26.33.png
devkev commented 9 years ago

Looks like the culprit is here:

https://github.com/flowdock/oulu/blob/ff98112e4aaf8a2aee48a065323f29d349e8c73b/lib/events/file_event.rb#L6

Just need to properly URI escape the contents of @message['content']['path'], right?