Ticket #145 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

URL containing .jpg interpreted wrongly as image

Reported by: DotMG Owned by: DotMG
Priority: normal Milestone: 1.1.6.2
Component: formatters Version: 1.1.6.1
Severity: normal Keywords: Regex Image formatters
Cc:

Description

The code below will be treated as if you wanted to insert an image, because Regex will find \.png  http://wikkawiki.org/ThisFileIsNotAnImage.pngCozItHasAnDotHtmlExtension. This will be the case if a website's domain name or url path contains .png, .gif, .jpg or .mm Ex:  http://www.jpgsrc.org/index.php will be treated as image.

File to modify: formatters/wakka.php Lines 127 and 131. Replace /(.*)\.(gif|jpg|png)/si by /\.(gif|jpg|png)$/si and /(.*)\.(mm)/si by /\.(mm)$/si. I cannot do it now 'coz I don't have SVN client and I'm not yet familiar with.

Change History

Changed 4 years ago by DotMG

  • owner changed from unassigned to DotMG

Changed 4 years ago by JavaWoman

Actually, this RE occurs in a subclause of a condition with an RE which *itself* should be changed. And I thought we'd already agreed we shouldn't turn a 'raw' URL into an img tag.

Better to solve the whole URL-detection problem structurally, than to change an RE for something we shouldn't do in the first place...

My 2 (euro) cents.

Changed 4 years ago by DarTar

thought we'd already agreed we shouldn't turn a 'raw' URL into an img tag

Yes in principles, but what about backward compatibility?

Changed 4 years ago by JavaWoman

You can maintain a "type" of backward compatibility here by 1) spelling out the full URL and 2) adding a message that in order to embed the image the image action should be used.

In general, you cannot be completely backwards compatible with bugs - just make it as easy as possible to migrate to a more compliant document. By spelling out the URL people who can't edit the file can still copy & paste that into their browser if they want to see the image.

Changed 4 years ago by DarTar

OK, sounds reasonable

Changed 4 years ago by DotMG

  • status changed from new to closed
  • resolution set to fixed

Fixed [47]

Changed 4 years ago by DarTar

Hi DotMG, I was thinking of a way to preserve backwards compatibility and I find JW's suggestion above sensible - maybe we should add a message when inline images are parsed. I'll try to figure out what the most elegant solution is.

Note: See TracTickets for help on using tickets.