Dotclear

Ticket #720 (closed defect: fixed)

Opened 17 years ago

Last modified 16 years ago

URL with ~ (or others) not supported correctly in media management

Reported by: jcdubacq Owned by: xave
Priority: normal Milestone: 2.1.6
Component: module:clearbricks Version: 2.1
Severity: major Keywords: media
Cc:

Description

Due to the use of sprintf on the URL (line 269 of inc/core/class.dc.media.php) the media management works incorrectly (no thumbnail shown, various other strange things) when the URL of the blog contains a % sign (which happens if you have a ~ in your URL) because ~ becomes %7E and this is interpreted by sprintf.

Simple patch:

--- inc/core/class.dc.media.php (révision 2743)
+++ inc/core/class.dc.media.php (copie de travail)
@@ -267,7 +267,7 @@
                        $f->media_thumb = array();
                        $p = path::info($f->relname);
                        $thumb = sprintf($this->thumb_tp,$this->root.'/'.$p['dir
name'],$p['base'],'%s');
-                       $thumb_url = sprintf($this->thumb_tp,$this->root_url.$p[
'dirname'],$p['base'],'%s');
+                       $thumb_url = sprintf($this->thumb_tp,preg_replace('#%#',
'%%',$this->root_url).$p['dirname'],$p['base'],'%s');
                        
                        # Cleaner URLs
                        $thumb_url = preg_replace('#\./#','/',$thumb_url);

Change History

comment:1 Changed 17 years ago by xave

  • Owner changed from olivier to xave
  • Status changed from new to assigned

I bet a broader solution is to be studied, where a good escaping is done in every case. I think we already have the right fuctions to do so.

comment:2 Changed 17 years ago by jcdubacq

Possibly. This one was quite annoying to me. See also #592 (same type of error inside clearbricks).

comment:3 Changed 16 years ago by xave

  • Component changed from module:core to module:clearbricks
  • Milestone changed from 2.2 to 2.1.6

comment:4 Changed 16 years ago by xave

  • Status changed from assigned to closed
  • Resolution set to duplicate

See #592

comment:5 Changed 16 years ago by xave

  • Status changed from closed to reopened
  • Resolution duplicate deleted

further tests show it is not a duplicate

comment:6 Changed 16 years ago by xave

I see no need to use "%7E" rather than "~" in public_path. Anyway...

comment:7 Changed 16 years ago by xave

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [2830]) URL protection Closes #720.

Note: See TracTickets for help on using tickets.

Sites map