Opened 13 years ago
Last modified 6 years ago
#10450 new defect
Do not linewrap long URLs in text emails
Reported by: | ezyang | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | undecided |
Component: | notification | Version: | |
Severity: | normal | Keywords: | wiki_to_text |
Cc: | ezyang@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When there is a long URL with dashes (or other linewrappable characters) sent in an email, it will get line-wrapped on the dash for the text version of the email, breaking the link. This is bad.
Here is an example:
http://lists.freedesktop.org/archives/systemd-devel/2011-March/001404.html
Attachments (0)
Change History (6)
comment:2 by , 12 years ago
comment:3 by , 12 years ago
I misinterpreted the documentation to mean wrapping on hyphens was supposed to be disabled when break_long_words=0
, but it's not.
So, yes, it's not obvious if/how this should be done. I guess if we really want this, we could try:
- Finding URLs using some Regex
- Escaping hyphens
- Wrapping the text
- Unescaping hyphens
How valuable is breaking on hyphenated parts? How valuable is not breaking long URLs?
How would this be solved by a text formatter for wiki? You mean instead of assuming some Regex matches all URLs, it could assume URLs only appear in wiki link syntax?
comment:4 by , 12 years ago
Milestone: | → undecided |
---|
All the tickets for {20} from last year have probably been seen multiple times by now, yet are still to be triaged…
comment:5 by , 8 years ago
Keywords: | wiki_to_text added |
---|
comment:6 by , 6 years ago
Just adding a plus one to hopefully resuscitate this. We found this issue affects the WordPress trac system breaking long URLs. The WP ticket (https://meta.trac.wordpress.org/ticket/3754) was closed in favour of this one in hopes the issue can be resolved upstream. Thank you
This is caused in TicketNotifyEmail by trac.util.text.wrap, which uses
trac.util.text.UnicodeTextWrapper
(introduced for #10006), a subclass of Python'stextwrap.TextWrapper
.Since Python 2.6
textwrap.TextWrapper
accepts a break_on_hyphens argument. That's irrelevant though since:break_long_words=0
.UnicodeTextWrapper
subclass overrides the splitting behavior, ignoring that flag.Just going by the comment, I tried removing the hyphenated words part of
split_re
. That does seem to result in notification mails where URLs are not wrapped. Other use cases might still want that though, of course.