Edgewall Software
Modify

Ticket #8168 (new defect)

Opened 3 years ago

Last modified 7 months ago

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

Reported by: fermaf@… Owned by:
Priority: high Milestone: next-minor-0.12.x
Component: wiki system Version: 0.11.2.1
Severity: normal Keywords:
Cc: lists@…, al.willmer@…
Release Notes:
API 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

Change History

comment:1 Changed 3 years ago by cboos

  • Milestone set to 0.11.6

Yep, reproduced.

comment:2 follow-up: Changed 2 years ago by François Terrier <fterrier@…>

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 Changed 2 years ago by mrelbe <mikael@…>

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=...)]]

comment:4 in reply to: ↑ 2 Changed 16 months ago by Thijs Triemstra <lists@…>

  • 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 Changed 16 months ago by Thijs Triemstra <lists@…>

  • Summary changed from wiki [[Image(URL)]], the URL address is truncated to its 74 first characters. to 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 Changed 13 months ago by dstoecker

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 Changed 11 months ago by iargent@…

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 Changed 11 months ago by iargent@…

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 Changed 7 months ago by al.willmer@…

  • Cc al.willmer@… added
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from (none). Next status will be 'new'
The owner will be changed from (none) to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.