itemroute fix

This commit is contained in:
Flummi
2021-12-20 17:55:47 +01:00
parent d5eada1814
commit 37789979c4
2 changed files with 79 additions and 100 deletions

View File

@@ -66,6 +66,8 @@ export default new class {
return link.join("/");
};
parseTag(tag) {
if(!tag)
return null;
return tag
.replace(/%20/g, " ");
}
@@ -95,5 +97,13 @@ export default new class {
const derivedKey = await scrypt(str, salt, 64);
return crypto.timingSafeEqual(keyBuffer, derivedKey);
};
async getTags(itemid) {
const tags = await sql("tags_assign")
.leftJoin("tags", "tags.id", "tags_assign.tag_id")
.where("tags_assign.item_id", itemid);
for(let t = 0; t < tags.length; t++)
tags[t].tag = tags[t].tag.replace(/[\u00A0-\u9999<>\&]/g, i => '&#'+i.charCodeAt(0)+';');
return tags;
};
};