Edgewall Software
Modify

Opened 16 years ago

Closed 10 years ago

Last modified 10 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:

Description

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

[[Image(http://www.lacasadelaposada.com/casa91.jpg)]]

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:

[[Image(http://chart.apis.google.com/chart?cht=bvs&chs=500x200&chco=00FF00,FF0000&chdl=OnTime|TimeOut&chd=t:0,0,0,1,0,1,0,0,0,1,0,0|0,0,0,3,0,0,0,0,1,0,4,2&chds=0,5&chbh=25&chtt=Evoluci%C3%B3n+de+Tickets+Cerrados(Fixed)|Prioridad:%22Normal%22|Semanalmente+2009&chxt=x,y,x,y&chxl=0:|1|2|3|4|5|6|7|8|9|10|11|12|1:||1|2|3|4|5|2:|||Semanas+del+2009||||||(%C3%BAltima%20es%20del16+al+22+de+marzo)|3:|||||Cantidad)]]

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:

http://chart.apis.google.com/chart?cht=bvs&chs=500x200&chco=00FF00,FF0000

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

Attachments (0)

Change History (16)

comment:1 by Christian Boos, 16 years ago

Milestone: 0.11.6

Yep, reproduced.

comment:2 by François Terrier <fterrier@…>, 15 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@…>, 15 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@…>, 14 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@…>, 14 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:

[[Image(http://www.arunalabs.com/blogs/wp-content/uploads/2007/05/aruna_url_yahoo_widget_short_url.png)]]

Renaming the ticket.

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

Alternatively a Quoting could be useful. Something like

  [[Image('pict,ure.png')]]

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

comment:7 by iargent@…, 14 years ago

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

http://apps.vanpuffelen.net/charts/burndown.jsp

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

comment:8 by iargent@…, 14 years ago

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

[[Image(http://apps.vanpuffelen.net/charts/burndown.jsp?days=9%2C10%2C11%2C14%2C15%2C16%2C17%2C18%2C21%2C22%2C23%2C24%2C25%2C28%2C29%2C30%2C31&work=236%2C230)]]

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

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

Cc: al.willmer@… added

comment:10 by Dirk Stöcker, 10 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, 10 years ago

Milestone: next-minor-0.12.x1.0.2
Version: 0.11.2.11.0.1

comment:12 by Jun Omae, 10 years ago

Milestone: 1.0.2next-stable-1.0.x

comment:13 by Ryan J Ollos, 10 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 10 years ago by Ryan J Ollos (previous) (diff)

comment:14 by Ryan J Ollos, 10 years ago

Release Notes: modified (diff)

comment:15 by Ryan J Ollos, 10 years ago

Resolution: fixed
Status: assignedclosed

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

comment:16 by Ryan J Ollos, 10 years ago

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
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.