feat: allow % in tags, #10135

isekai-main
Barış Soner Uşaklı 3 years ago
parent 42caef7fa7
commit a75a043b61

@ -140,7 +140,7 @@ ajaxify = window.ajaxify || {};
if (data) {
let status = parseInt(data.status, 10);
if (status === 403 || status === 404 || status === 500 || status === 502 || status === 503) {
if ([400, 403, 404, 500, 502, 504].includes(status)) {
if (status === 502 && retry) {
retry = false;
ajaxifyTimer = undefined;

@ -334,7 +334,7 @@
tag = tag.trim().toLowerCase();
// see https://github.com/NodeBB/NodeBB/issues/4378
tag = tag.replace(/\u202E/gi, '');
tag = tag.replace(/[,/#!$%^*;:{}=_`<>'"~()?|]/g, '');
tag = tag.replace(/[,/#!$^*;:{}=_`<>'"~()?|]/g, '');
tag = tag.substr(0, maxLength || 15).trim();
const matches = tag.match(/^[.-]*(.+?)[.-]*$/);
if (matches && matches.length > 1) {

@ -134,6 +134,7 @@ function modifyTopic(topic, fields) {
return {
value: tag,
valueEscaped: escaped,
valueEncoded: encodeURIComponent(escaped),
class: escaped.replace(/\s/g, '-'),
};
});

@ -285,6 +285,7 @@ module.exports = function (Topics) {
}
tags.forEach((tag) => {
tag.valueEscaped = validator.escape(String(tag.value));
tag.valueEncoded = encodeURIComponent(tag.valueEscaped);
tag.class = tag.valueEscaped.replace(/\s/g, '-');
});
return tags;

Loading…
Cancel
Save