[dokuwiki] Re: Duplicate slash patch
- From: "Ilya S. Lebedev" <ilya@xxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Fri, 18 Apr 2008 07:28:35 +0400
Hello, Andreas
Friday, April 18, 2008, 12:58:59 AM you wrote:
>> This patch fixes getBaseURL function, producing 2 consecutive slashes
>> in the URL. Patch contains fix and test for it.
AG> Hmm your test uses 'http:/example.com/' as baseurl!? There's a missing
AG> second slash?
My test uses $conf['baseurl'] param in a form, i've reached the bug on
the production site. With the value above, getBaseURL produces
http://example.com//. That's a bug.
AG> Your preg_replace('!^/+!','',$dir); will remove every slash from $dir!?
This reg kills only the starting slashes, note ^ anchor on the start.
But proper one is !/+$! reg to kill trailing slashes from the host, i
forgot to add the following test.
function test11(){
global $conf;
$conf['basedir'] = '/dokuwiki';
$conf['baseurl'] = 'http:/example.com';
$conf['canonical'] = 1;
$this->assertEqual(getBaseURL(),'http:/example.com/dokuwiki/');
}
Attached patch includes the proper fix and the test above.
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
- Follow-Ups:
- [dokuwiki] Re: Duplicate slash patch
- From: Christopher Smith
- References:
- [dokuwiki] Duplicate slash patch
- From: Ilya S. Lebedev
- [dokuwiki] Re: Duplicate slash patch
- From: Andreas Gohr
Other related posts:
- » [dokuwiki] Duplicate slash patch
- » [dokuwiki] Re: Duplicate slash patch
- » [dokuwiki] Re: Duplicate slash patch
- » [dokuwiki] Re: Duplicate slash patch
- » [dokuwiki] Re: Duplicate slash patch
- » [dokuwiki] Re: Duplicate slash patch
- [dokuwiki] Re: Duplicate slash patch
- From: Christopher Smith
- [dokuwiki] Duplicate slash patch
- From: Ilya S. Lebedev
- [dokuwiki] Re: Duplicate slash patch
- From: Andreas Gohr