mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-12-04 05:56:27 +01:00
Sanitize author descriptions before they are stored or returned
This commit is contained in:
1 parent
83dce682e8
commit
bf1c5688b9
3 files changed
+169
-4
No files matched your search
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user