sanitize album artist biography

This commit is contained in:
Kendall Garner
2024-04-03 07:36:13 -07:00
parent 24394fa858
commit 7bebe286d5
5 changed files with 385 additions and 18 deletions
+16
View File
@@ -0,0 +1,16 @@
import sanitizeHtml, { IOptions, simpleTransform } from 'sanitize-html';
const SANITIZE_OPTIONS: IOptions = {
allowedAttributes: {
a: ['href', 'rel', 'target'],
},
allowedSchemes: ['http', 'https', 'mailto'],
allowedTags: ['a', 'b', 'div', 'em', 'i', 'p', 'strong'],
transformTags: {
a: simpleTransform('a', { rel: 'noopener noreferrer', target: '_blank' }),
},
};
export const sanitize = (text: string): string => {
return sanitizeHtml(text, SANITIZE_OPTIONS);
};