some code of lib/scripts/cookie.js
/**
* Save a value to the cookie
*
* @author Andreas Gohr
*/
setValue: function(key,val){
var text = [],
_this = this;
this.init();
this.data[key] = val;
//save the whole data array
jQuery.each(_this.data, function (key, val) {
if (_this.data.hasOwnProperty(key)) {
text.push(encodeURIComponent(key)+'#'+encodeURIComponent(val));
}
});
jQuery.cookie(this.name, text.join('#'), {expires: 365, path: DOKU_BASE});
},
when conf[canonical] = 0:
wiki A: var DOKU_BASE = '/wiki/';
wiki B: var DOKU_BASE = '/';
when conf[canonical] = 1
wiki A: var DOKU_BASE = 'http://wiebertje.domain.org/wiki/'; or in another setup:
wiki B: var DOKU_BASE = 'http://wiebertje.dokuwiki/'
This has wrong behavior when: config canonical=true and useslash=true, due to:
- the DOKU_BASE is an absolute url
- this DOKU_BASE is set as path, but this is not a correct path, so this path is ignored and is determined from the current page instead.
- when the current page is a page in a namespace e.g.
http://wiebertje.domain.org/wiki/users/2013/what_s the path applied in the cookie becomes: /wiki/users/2013/what_s
How to solve this issue?
suggestion 1: add a new constant DOKU_BASEPATH e.g. with value: var DOKU_BASEPATH = '/wiki/';
suggestion 2: if DOKU_BASE is a domain (that is, it starts with https?://), remove the first part of DOKU_BASE using 'document.domain' so only the desired path is obtained