[dokuwiki] Re: Duplicate slash patch

  • From: "Ilya S. Lebedev" <ilya@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 30 Apr 2008 23:27:21 +0400

Hello, Christopher

Nice to see this bug fixed.

As another suggestion, you can add some function for the path
concatenation which will do the job. Function might look like the
following:

/**
 *  function takes any number or arguments as path parts and
 *  concatenates them in the *nix notation
 */
function gluePath() {
    $all = func_get_args();
    $all = join('/',$all);
    $all = preg_replace("{(((?<!^|:)[\\\\/]){2,}|[\\\\])}s", "/", $all);
    $all = preg_replace("{/$}s", "", $all);
    return $all;
}


Friday, April 18, 2008, 2:33:56 PM you wrote:

CS> I've sent Andi a slighltly different patch to correct this problem.

CS> You're right in today's message, the correct adjustment is to remove  
CS> any trailing slash from $conf['baseurl'].  Yesterday's patch required
CS> a trailing slash, where as dokuwiki documentation does not state its  
CS> required.

CS> My patch uses rtrim rather than preg_replace and updates the rest of  
CS> the function to make it resilient to the vagaries of leading and  
CS> trailing slashes on user supplied config values.

CS> - Chris

CS> On 18 Apr 2008, at 04:28, Ilya S. Lebedev wrote:
>>
>> But proper one is !/+$! reg to kill trailing slashes from the host, i
>> forgot to add the following test.
>>
>> <snip>
>>
>> AG> Can you explain what the exact problem was?
>>
>> DOKU_URL containing http://example.com//, http://example.com//wiki/
>> breaks compressed CSS files, because compressor recognizes 2nd
>> duplicate slash as a comment. I prefer to fix invalid url at first.
>>
>>
>> -- 
>> Best regards,
>> Ilya                          mailto:ilya@xxxxxxxxxxx<dupslash.patch>




-- 
С уважением,
 Ilya                          mailto:ilya@xxxxxxxxxxx

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: