Sanitize author descriptions before they are stored or returned

This commit is contained in:
mikiher committed 2026-11-18 06:52:42 +02:00
1 parent 83dce682e8
commit bf1c5688b9
3 files changed
+169 -4

No files matched your search

+7 -1
View File
@@ -1,5 +1,6 @@
const { DataTypes, Model, where, fn, col } = require('sequelize')
const parseNameString = require('../utils/parsers/parseNameString')
const htmlSanitizer = require('../utils/htmlSanitizer')
class Author extends Model {
constructor(values, options) {
@@ -175,11 +176,16 @@ class Author extends Model {
}
toOldJSON() {
let description = this.description
if (description) {
description = htmlSanitizer.sanitize(description) || null
}
return {
id: this.id,
asin: this.asin,
name: this.name,
description: this.description,
description,
imagePath: this.imagePath,
libraryId: this.libraryId,
addedAt: this.createdAt.valueOf(),