1940: Spaces in URL path are not encoded as %20 in email notifications

quinn******@mac**** (Google Code) (Is this you? Claim this profile.)
March 14, 2011
What version are you running?

1.5.1

What's the URL of the page containing the problem?

n/a, it's in an email

What steps will reproduce the problem?
1. Enable email notifications for review requests.
2. Submit a review request for a path containing one or more spaces.

What is the expected output? What do you see instead?

The web page for the review displays correct links under Files Changed (the href has unescaped URLs, but the browser automatically handles spaces), but the notification email does not. My email client auto-senses URLs and only picks up the part up to the first space. If the URL were encoded such that spaces are replaced by %20, the links would work just fine. This problem occurs both in the plain text and HTML parts of the email.

What operating system are you using? What browser?

Mac OS X 10.6.6, Safari 5, Mail.app
chipx86
#1 chipx86
None of the URLs we provide should have spaces. I'm not sure what URL you're talking about. Can you show me?
  • +NeedInfo
#2 quinn******@mac**** (Google Code) (Is this you? Claim this profile.)
Sorry, the URLs I'm talking about are repository paths for the files changed in a given diff. (I have RB connected to our Subversion repository.) When there are spaces in the path (either for a directory or filename) the email dutifully prints the URL as-is. The trouble starts when I try to click on a link to jump to such a file.

For example, if I submit a review request for a diff affecting this URL:
    http://svn.example.com/trunk/A Spaceful Directory Name/foo.java

the email that is sent will include this URL in a bulleted list, but without accounting for spaces, the URL is recognized as:
    http://svn.example.com/trunk/A

Obviously, this is not a URL that RB is creating per se, but is IS something that can be defended against. One simple approach to fix this is detailed here:

http://stackoverflow.com/questions/120951/how-can-i-normalize-a-url-in-python#845595

    import urllib
    url = urllib.quote(url, safe="%/:=&?~#+!$,;'@()*[]")

This percent escapes spaces and other characters, but avoid escaping the colon in the scheme, etc. The result is:
    http://svn.example.com/trunk/A%20Spaceful%20Directory%20Name/foo.java

Hopefully this provides enough context to clarify the problem I'm seeing. Thanks!
david
#3 david
It sounds like your email client is auto-linking things? I don't think we can do anything here, because SCM paths are any number of formats, and so we can't decide to URL-encode them without potentially breaking things.
  • -NeedInfo
    +ThirdParty