mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #8757, allow all slashes in category route
This commit is contained in:
@@ -59,7 +59,7 @@ module.exports = function (User) {
|
|||||||
settings.restrictChat = parseInt(getSetting(settings, 'restrictChat', 0), 10) === 1;
|
settings.restrictChat = parseInt(getSetting(settings, 'restrictChat', 0), 10) === 1;
|
||||||
settings.topicSearchEnabled = parseInt(getSetting(settings, 'topicSearchEnabled', 0), 10) === 1;
|
settings.topicSearchEnabled = parseInt(getSetting(settings, 'topicSearchEnabled', 0), 10) === 1;
|
||||||
settings.bootswatchSkin = validator.escape(String(settings.bootswatchSkin || ''));
|
settings.bootswatchSkin = validator.escape(String(settings.bootswatchSkin || ''));
|
||||||
settings.homePageRoute = validator.escape(String(settings.homePageRoute || '')).replace('/', '/');
|
settings.homePageRoute = validator.escape(String(settings.homePageRoute || '')).replace(///g, '/');
|
||||||
settings.scrollToMyPost = parseInt(getSetting(settings, 'scrollToMyPost', 1), 10) === 1;
|
settings.scrollToMyPost = parseInt(getSetting(settings, 'scrollToMyPost', 1), 10) === 1;
|
||||||
settings.categoryWatchState = getSetting(settings, 'categoryWatchState', 'notwatching');
|
settings.categoryWatchState = getSetting(settings, 'categoryWatchState', 'notwatching');
|
||||||
|
|
||||||
|
|||||||
31
test/user.js
31
test/user.js
@@ -1706,6 +1706,37 @@ describe('User', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should properly escape homePageRoute', function (done) {
|
||||||
|
var data = {
|
||||||
|
uid: testUid,
|
||||||
|
settings: {
|
||||||
|
bootswatchSkin: 'default',
|
||||||
|
homePageRoute: 'category/6/testing-ground',
|
||||||
|
homePageCustom: '',
|
||||||
|
openOutgoingLinksInNewTab: 0,
|
||||||
|
scrollToMyPost: 1,
|
||||||
|
userLang: 'en-GB',
|
||||||
|
usePagination: 1,
|
||||||
|
topicsPerPage: '10',
|
||||||
|
postsPerPage: '5',
|
||||||
|
showemail: 1,
|
||||||
|
showfullname: 1,
|
||||||
|
restrictChat: 0,
|
||||||
|
followTopicsOnCreate: 1,
|
||||||
|
followTopicsOnReply: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
socketUser.saveSettings({ uid: testUid }, data, function (err) {
|
||||||
|
assert.ifError(err);
|
||||||
|
User.getSettings(testUid, function (err, data) {
|
||||||
|
assert.ifError(err);
|
||||||
|
assert.strictEqual(data.homePageRoute, 'category/6/testing-ground');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should error if language is invalid', function (done) {
|
it('should error if language is invalid', function (done) {
|
||||||
var data = {
|
var data = {
|
||||||
uid: testUid,
|
uid: testUid,
|
||||||
|
|||||||
Reference in New Issue
Block a user