[PR #4355] [MERGED] Sanitize media item & episode description on update #4221

Closed
opened 2026-04-25 00:18:52 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4355
Author: @advplyr
Created: 6/1/2025
Status: Merged
Merged: 6/1/2025
Merged by: @advplyr

Base: masterHead: sanitize_html_description


📝 Commits (1)

  • 9052cee Sanitize media item & episode description on update

📊 Changes

3 files changed (+30 additions, -1 deletions)

View changed files

📝 server/controllers/PodcastController.js (+10 -0)
📝 server/models/Book.js (+10 -1)
📝 server/models/Podcast.js (+10 -0)

📄 Description

Brief summary

This is an API update to sanitize HTML descriptions

Which issue is fixed?

No issue, related to #4349

In-depth Description

API endpoints /items/:id/media and /api/podcasts/:id/episode/:episodeId support updating the description for book/podcast & podcast episodes.

Since those descriptions support HTML they need to be sanitized.

Sanitization options

{
    allowedTags: ['p', 'ol', 'ul', 'li', 'a', 'strong', 'em', 'del', 'br', 'b', 'i'],
    disallowedTagsMode: 'discard',
    allowedAttributes: {
      a: ['href', 'name', 'target']
    },
    allowedSchemes: ['http', 'https', 'mailto'],
    allowProtocolRelative: false
  }

How have you tested this?

API


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/4355 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 6/1/2025 **Status:** ✅ Merged **Merged:** 6/1/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `sanitize_html_description` --- ### 📝 Commits (1) - [`9052cee`](https://github.com/advplyr/audiobookshelf/commit/9052ceedd3659aca1e6b227e62fe0687c1d94336) Sanitize media item & episode description on update ### 📊 Changes **3 files changed** (+30 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `server/controllers/PodcastController.js` (+10 -0) 📝 `server/models/Book.js` (+10 -1) 📝 `server/models/Podcast.js` (+10 -0) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary This is an API update to sanitize HTML descriptions ## Which issue is fixed? No issue, related to #4349 ## In-depth Description API endpoints `/items/:id/media` and `/api/podcasts/:id/episode/:episodeId` support updating the description for book/podcast & podcast episodes. Since those descriptions support HTML they need to be sanitized. Sanitization options ```js { allowedTags: ['p', 'ol', 'ul', 'li', 'a', 'strong', 'em', 'del', 'br', 'b', 'i'], disallowedTagsMode: 'discard', allowedAttributes: { a: ['href', 'name', 'target'] }, allowedSchemes: ['http', 'https', 'mailto'], allowProtocolRelative: false } ``` ## How have you tested this? API --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:18:52 +02:00
adam closed this issue 2026-04-25 00:18:52 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4221