Edgewall Software
Modify

Opened 8 years ago

Last modified 15 months 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:

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:1 by Peter Suter, 7 years ago

This is caused in TicketNotifyEmail by trac.util.text.wrap, which uses trac.util.text.UnicodeTextWrapper (introduced for #10006), a subclass of Python's textwrap.TextWrapper.

Since Python 2.6 textwrap.TextWrapper accepts a break_on_hyphens argument. That's irrelevant though since:

  1. We already pass break_long_words=0.
  2. The 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.

Last edited 7 years ago by Peter Suter (previous) (diff)

comment:2 by Christian Boos, 7 years ago

But how to distinguish hyphenated parts inside URLs and outside of them? This sounds like another argument in favor of a text formatter for the wiki… (#4270, #9879).

comment:3 by Peter Suter, 7 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:

  1. Finding URLs using some Regex
  2. Escaping hyphens
  3. Wrapping the text
  4. 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 Christian Boos, 7 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 Peter Suter, 3 years ago

Keywords: wiki_to_text added

comment:6 by Garrett Hyder <garrett@…>, 15 months 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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.