You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-07-15 01:24:25 +02:00
Adding base url to language redirect. fixes #793
This commit is contained in:
@ -12,6 +12,7 @@ import {ServerTimeEntry} from '../middlewares/ServerTimingMWs';
|
|||||||
import {ClientConfig, TAGS} from '../../common/config/public/ClientConfig';
|
import {ClientConfig, TAGS} from '../../common/config/public/ClientConfig';
|
||||||
import {QueryParams} from '../../common/QueryParams';
|
import {QueryParams} from '../../common/QueryParams';
|
||||||
import {PhotoProcessing} from '../model/fileaccess/fileprocessing/PhotoProcessing';
|
import {PhotoProcessing} from '../model/fileaccess/fileprocessing/PhotoProcessing';
|
||||||
|
import {Utils} from '../../common/Utils';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
@ -64,7 +65,7 @@ export class PublicRouter {
|
|||||||
if (Config.Server.languages.indexOf(locale) !== -1) {
|
if (Config.Server.languages.indexOf(locale) !== -1) {
|
||||||
res.cookie(CookieNames.lang, locale);
|
res.cookie(CookieNames.lang, locale);
|
||||||
}
|
}
|
||||||
res.redirect('/?ln=' + locale);
|
res.redirect(Utils.concatUrls('/' + Config.Server.urlBase) + '/?ln=' + locale);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,7 +10,9 @@ describe('Utils', () => {
|
|||||||
expect(Utils.concatUrls('abc\\', 'cde')).to.be.equal('abc/cde');
|
expect(Utils.concatUrls('abc\\', 'cde')).to.be.equal('abc/cde');
|
||||||
expect(Utils.concatUrls('abc/', 'cde/')).to.be.equal('abc/cde');
|
expect(Utils.concatUrls('abc/', 'cde/')).to.be.equal('abc/cde');
|
||||||
expect(Utils.concatUrls('./abc\\', 'cde/')).to.be.equal('./abc/cde');
|
expect(Utils.concatUrls('./abc\\', 'cde/')).to.be.equal('./abc/cde');
|
||||||
|
expect(Utils.concatUrls('/abc\\', 'cde/')).to.be.equal('/abc/cde');
|
||||||
expect(Utils.concatUrls('abc/', '\\cde/')).to.be.equal('abc/cde');
|
expect(Utils.concatUrls('abc/', '\\cde/')).to.be.equal('abc/cde');
|
||||||
|
expect(Utils.concatUrls('/abc/', '\\cde/')).to.be.equal('/abc/cde');
|
||||||
expect(Utils.concatUrls('abc\\', '\\cde/')).to.be.equal('abc/cde');
|
expect(Utils.concatUrls('abc\\', '\\cde/')).to.be.equal('abc/cde');
|
||||||
expect(Utils.concatUrls('abc\\', '/cde/')).to.be.equal('abc/cde');
|
expect(Utils.concatUrls('abc\\', '/cde/')).to.be.equal('abc/cde');
|
||||||
expect(Utils.concatUrls('abc/', '/cde/')).to.be.equal('abc/cde');
|
expect(Utils.concatUrls('abc/', '/cde/')).to.be.equal('abc/cde');
|
||||||
|
Reference in New Issue
Block a user