client/tags: escape dots in search term and don't allow '.' and '..' as tags

This commit is contained in:
neobooru 2021-04-12 10:42:58 +02:00
parent 7c37734fec
commit 4ce72fa712
2 changed files with 3 additions and 2 deletions

View file

@ -163,7 +163,8 @@ class TagInputControl extends events.EventTarget {
addTagByName(name, source) {
name = name.trim();
if (!name) {
// Tags `.` and `..` are not allowed, see https://github.com/rr-/szurubooru/pull/390
if (!name || name == "." || name == "..") {
return;
}
return Tag.get(name).then(

View file

@ -187,7 +187,7 @@ function arraysDiffer(source1, source2, orderImportant) {
}
function escapeSearchTerm(text) {
return text.replace(/([a-z_-]):/g, "$1\\:");
return text.replace(/([a-z_-]):/g, "$1\\:").replace(/\./g, "\\.");
}
function dataURItoBlob(dataURI) {