Edgewall Software

Opened 12 years ago

Closed 6 years ago

Last modified 6 years ago

#8168 closed defect (fixed)

wiki [[Image(URL)]] breaks when the URL contains commas

Reported by: fermaf@… Owned by: Dirk Stöcker
Priority: high Milestone: 1.0.5
Component: wiki system Version: 1.0.1
Severity: normal Keywords:
Cc: lists@…, al.willmer@… Branch:
Release Notes:

Arguments to the Image macro can be wrapped in single or double quotes to avoid splitting at commas.

API Changes:
Internal Changes:


I'm trying to publish a wiki page in my trac using a the Image Macro.
When I post an image like this:


There is no problem and the image is displayed correctly in the browser and when I focus on the image the URL context information (left botton corner is shown correctly).

But when I use a longest URL address like this:


The image is not displayed and the context information in my browser (left botton corner) only shows a truncated URL when I am on the place where should be the image. The url displayed has a length 74 characters. like this:


I have test it using Firefox, Explorer and Opera and the same problem.

Attachments (0)

Change History (16)

comment:1 by Christian Boos, 12 years ago

Milestone: 0.11.6

Yep, reproduced.

comment:2 by François Terrier <fterrier@…>, 11 years ago

The syntax of the image macro is [[Image(path, [args,] arg)]. Take for instance for the url http://www.google.com/?image=1,2,3,4,5 then it will be parsed as the following:

  • path=http://www.google.com/?image=1
  • arg1=2
  • arg2=3

The path is then wrong and since the arguments do not match the predefined argument list, they will simply be ignored.

One solution would be to have the path be everything that is before the first recognized argument. It would fix the issue for this ticket but what if the URL contains a valid argument, eg. : http://www.google.com/?image=1,title=test then title=test will be considered as an argument although it is part of the URL.

Another solution would be to introduce an escape character for the commas. The macro to insert the URL above would the be [[Image(http://www.google.com/?image=1\,2\,3\,4\,5)]]

What do you think ?

comment:3 by mrelbe <mikael@…>, 11 years ago

I think quoting the URL should be the correct syntax, inline with ordinary links: [[Image("http://www.google.com/?image=1,2,3,4,5", arg=...)]]

in reply to:  2 comment:4 by Thijs Triemstra <lists@…>, 10 years ago

Cc: lists@… added

Replying to François Terrier <fterrier@…>:

What do you think ?

Sounds like the bigger problem here but hopefully this particular bug can be patched in the meantime?

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

Summary: wiki [[Image(URL)]], the URL address is truncated to its 74 first characters.wiki [[Image(URL)]] breaks when the URL contains commas

So yea, it's not related to 74 chars, it's the parsing of comma's like Francois describes in comment:2. Here's a 94 char url that works:


Renaming the ticket.

comment:6 by Dirk Stöcker, 10 years ago

Alternatively a Quoting could be useful. Something like


This should be easy to implement and also would work for other macros which use same argument parsing.

comment:7 by iargent@…, 10 years ago

I found a solution - URL-encode each comma as %2C, like this:


Took me too long to figure this out, so I hope it helps someone else.

comment:8 by iargent@…, 10 years ago

I found a solution - URL-encode each comma as %2C, like this:


Took me too long to figure this out, so I hope it helps someone else.

comment:9 by al.willmer@…, 9 years ago

Cc: al.willmer@… added

comment:10 by Dirk Stöcker, 6 years ago

Note: The patch from r11732 can probably be adapted to allow proper quoting for the arguments as well and thus also solves #11773 without workaround.

comment:11 by Dirk Stöcker, 6 years ago

Milestone: next-minor-0.12.x1.0.2

comment:12 by Jun Omae, 6 years ago

Milestone: 1.0.2next-stable-1.0.x

comment:13 by Ryan J Ollos, 6 years ago

Milestone: next-stable-1.0.x1.0.5
Owner: set to Ryan J Ollos
Status: newassigned

As mentioned in comment:10, this will be resolved with #11773. IMAGE_MACRO_TEST_CASES will be extended to cover the URLs containing commas: tags/trac-1.0.4/trac/wiki/tests/macros.py@:56#L52.

I'm considering a function for trac.util.text that will split a string at the specified token(s) provided they aren't surrounded in quotes: SO:2787064/121694.

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:14 by Ryan J Ollos, 6 years ago

Release Notes: modified (diff)

comment:15 by Ryan J Ollos, 6 years ago

Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in [13787], merged to trunk in [13788].

comment:16 by Ryan J Ollos, 6 years ago

Owner: changed from Ryan J Ollos to Dirk Stöcker

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Dirk Stöcker.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Dirk Stöcker 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.