Edgewall Software
Modify

Opened 18 years ago

Closed 14 years ago

#3946 closed defect (fixed)

iCalendar export: no URL encoding in URL Property

Reported by: s.becker@… Owned by: osimons
Priority: normal Milestone: 0.12.1
Component: roadmap Version: 0.10b1
Severity: minor Keywords: ical verify bitesized
Cc: lists@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When using whitespace (or other special characters) in milestone names (e.g. "M001 KW42") and exporting the roadmap via iCalendar, the URL property should contain an URL encoded value.

E.g.

URL:http://some.host/trac/milestone/M001%20KW42

instead of

URL:http://some.host/trac/milestone/M001 KW42

Attachments (1)

abs_href.patch (727 bytes ) - added by Thijs Triemstra <lists@…> 14 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by Christian Boos, 18 years ago

Component: generalroadmap
Keywords: ical verify added
Milestone: 0.12
Owner: changed from Jonas Borgström to Christopher Lenz
Severity: normalminor

comment:2 by Christian Boos, 14 years ago

Keywords: bitesized added
Milestone: next-major-0.1Xunscheduled

comment:3 by Thijs Triemstra <lists@…>, 14 years ago

Cc: lists@… added

Confirmed, content below, but the browser redirects to the correct url though..

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Edgewall Software//NONSGML Trac 0.12.1dev-r10147//EN
METHOD:PUBLISH
X-WR-CALNAME:My Project - Roadmap
BEGIN:VEVENT
UID:</milestone/M001 KW42@localhost:8080>
DTSTAMP:20110929T160000Z
DTSTART;VALUE=DATE:20110929
SUMMARY:Milestone M001 KW42
URL:http://localhost:8080/milestone/M001 KW42
END:VEVENT
END:VCALENDAR

comment:4 by osimons, 14 years ago

Milestone: unscheduled0.12.1
Owner: changed from Christopher Lenz to osimons

I had a look at the code, and it looks wrong - much like the code goes out of its way to avoid encoding? Anyway, if we treat it like any other URL it should be fine:

  • 0.12-stable/trac/ticket/roadmap.py

     
    444444                write_date('DTSTART', milestone.due)
    445445                write_prop('SUMMARY', _('Milestone %(name)s',
    446446                                        name=milestone.name))
    447                 write_prop('URL', req.base_url + '/milestone/' +
    448                            milestone.name)
     447                write_prop('URL', req.abs_href.milestone(milestone.name)
    449448                if milestone.description:
    450449                    write_prop('DESCRIPTION', milestone.description)
    451450                write_prop('END', 'VEVENT')

I've searched rfc:2445 for information, but it says nothing apart from identifying it as a URL - leaving it to regular handling. Like we do through a Href() instance.

Could you test the patch?

comment:5 by Thijs Triemstra <lists@…>, 14 years ago

ahh.. i came up with:

  • trac/ticket/roadmap.py

     
    1717
    1818from StringIO import StringIO
    1919from datetime import datetime, timedelta
     20from urllib import quote
    2021import re
    2122
    2223from genshi.builder import tag
     
    445446                write_prop('SUMMARY', _('Milestone %(name)s',
    446447                                        name=milestone.name))
    447448                write_prop('URL', req.base_url + '/milestone/' +
    448                            milestone.name)
     449                           quote(milestone.name))
    449450                if milestone.description:
    450451                    write_prop('DESCRIPTION', milestone.description)
    451452                write_prop('END', 'VEVENT')

I also couldn't find anything special about the URL, or whether the url part in the UID should contain be quoted or not. I'll test your patch.

producing:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Edgewall Software//NONSGML Trac 0.12.1dev-r10147//EN
METHOD:PUBLISH
X-WR-CALNAME:My Project - Roadmap
BEGIN:VEVENT
UID:</milestone/M001 KW42@localhost:8080>
DTSTAMP:20110929T160000Z
DTSTART;VALUE=DATE:20110929
SUMMARY:Milestone M001 KW42
URL:http://localhost:8080/milestone/M001%20KW42
END:VEVENT
END:VCALENDAR

by Thijs Triemstra <lists@…>, 14 years ago

Attachment: abs_href.patch added

comment:6 by Thijs Triemstra <lists@…>, 14 years ago

Your patch was missing a ')' at the end but worked fine, cheers. I attached an updated version of the patch.

comment:7 by osimons, 14 years ago

Oops - mistakes do happen :-) Thanks for testing.

Now that this serious issue of the patch quality itself is under control, I do not see this as a high impact or high risk change. I'd like to just commit this now for 0.12.1 unless anyone objects.

comment:8 by Remy Blank, 14 years ago

+1

comment:9 by osimons, 14 years ago

Resolution: fixed
Status: newclosed

Committed to 0.12-stable in [10149]. Merged to trunk in [10150].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from osimons to the specified user.

Add Comment


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