[PR #4223] [MERGED] Fix server crash when a user requests the RSS feed of an empty collection #4191

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

📋 Pull Request Information

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

Base: masterHead: feat/fixCrashEmptyCollection


📝 Commits (2)

📊 Changes

1 file changed (+7 additions, -3 deletions)

View changed files

📝 server/models/FeedEpisode.js (+7 -3)

📄 Description

Brief summary

Fix server crash when a user requests the RSS feed of an empty collection.

Which issue is fixed?

None/Discord

In-depth Description

reduce needs at least one item in the array (or intial value). If the array is empty, it throws an error. Since the for loop is not called when books is empty, we can just make this null. The RSS feed will still be opened then. An alternative would be to close the RSS feed for any empty collection. I can imagine that this would not be a good solution, because if people remove an item and then instantly add one, it would be unexpected to have a closed RSS feed.

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/4223 **Author:** [@Vito0912](https://github.com/Vito0912) **Created:** 4/26/2025 **Status:** ✅ Merged **Merged:** 4/26/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `feat/fixCrashEmptyCollection` --- ### 📝 Commits (2) - [`812cb5a`](https://github.com/advplyr/audiobookshelf/commit/812cb5a1602cb2159daf64be47f92e33ca4c1dc7) feat/fixCrashEmptyCollection - [`a1d549a`](https://github.com/advplyr/audiobookshelf/commit/a1d549a2b110ff44fe06c21f1ec2fcfa43279e04) prettier ### 📊 Changes **1 file changed** (+7 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `server/models/FeedEpisode.js` (+7 -3) </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 Fix server crash when a user requests the RSS feed of an empty collection. ## Which issue is fixed? None/Discord ## In-depth Description `reduce` needs at least one item in the array (or intial value). If the array is empty, it throws an error. Since the for loop is not called when `books` is empty, we can just make this null. The RSS feed will still be opened then. An alternative would be to close the RSS feed for any empty collection. I can imagine that this would not be a good solution, because if people remove an item and then instantly add one, it would be unexpected to have a closed RSS feed. ## 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:43 +02:00
adam closed this issue 2026-04-25 00:18:43 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4191