[PR #4075] [MERGED] Fixes search not returning results if description field is not provided by a custom provider #4160

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

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4075
Author: @Vito0912
Created: 3/4/2025
Status: Merged
Merged: 3/5/2025
Merged by: @advplyr

Base: masterHead: feat/fixCrashCustomProvider


📝 Commits (2)

  • a296ac6 fix crash
  • b17e601 Add validation for custom metadata provider responses

📊 Changes

1 file changed (+49 additions, -17 deletions)

View changed files

📝 server/providers/CustomProviderAdapter.js (+49 -17)

📄 Description

Brief summary

Checks if the type is string before passing it to sanitize, because sanitize throws an error if the type is not a string.

Another way would be to return null if the type is not a string instead of the current way to prevent this happening altogether in the sanitizer.

I am not sure if this is possible, but if the type would not be a string, then it would not go through the sanitizer. So if the type is somehow not a string, one could maybe include bad code. I am not that familiar with JavaScript's type system, so I don't know if it's possible that this variable could be something other than a string, null, or a number when numbers would be returned.

Which issue is fixed?

In-depth Description

How have you tested this?

Screenshots


🔄 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/4075 **Author:** [@Vito0912](https://github.com/Vito0912) **Created:** 3/4/2025 **Status:** ✅ Merged **Merged:** 3/5/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `feat/fixCrashCustomProvider` --- ### 📝 Commits (2) - [`a296ac6`](https://github.com/advplyr/audiobookshelf/commit/a296ac61325e9e2abbc3d641883f57ab2a420b4a) fix crash - [`b17e601`](https://github.com/advplyr/audiobookshelf/commit/b17e6010fd0014dc4e273911d3e86d9a4289e9f3) Add validation for custom metadata provider responses ### 📊 Changes **1 file changed** (+49 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `server/providers/CustomProviderAdapter.js` (+49 -17) </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 Checks if the type is string before passing it to sanitize, because sanitize throws an error if the type is not a string. Another way would be to return null if the type is not a string instead of the current way to prevent this happening altogether in the sanitizer. I am not sure if this is possible, but if the type would not be a string, then it would not go through the sanitizer. So if the type is somehow not a string, one could maybe include bad code. I am not that familiar with JavaScript's type system, so I don't know if it's possible that this variable could be something other than a string, null, or a number when numbers would be returned. ## Which issue is fixed? <!-- Which issue number does this PR fix? Ex: "Fixes #1234" --> ## In-depth Description <!-- Describe your solution in more depth. How does it work? Why is this the best solution? Does it solve a problem that affects multiple users or is this an edge case for your setup? --> ## How have you tested this? <!-- Please describe in detail with reproducible steps how you tested your changes. --> ## Screenshots <!-- If your PR includes any changes to the web client, please include screenshots or a short video from before and after your changes. --> --- <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:36 +02:00
adam closed this issue 2026-04-25 00:18:36 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4160