[PR #3921] [MERGED] Fix API including basepath in tracks contentUrl #4121

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

📋 Pull Request Information

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

Base: masterHead: fix_content_url_basepath


📝 Commits (1)

  • aebb3ff Fix API including basepath in tracks contentUrl

📊 Changes

6 files changed (+16 additions, -12 deletions)

View changed files

📝 client/pages/audiobook/_id/chapters.vue (+1 -4)
📝 client/players/AudioTrack.js (+10 -3)
📝 client/players/PlayerHandler.js (+1 -1)
📝 server/models/Book.js (+1 -1)
📝 server/models/PodcastEpisode.js (+1 -1)
📝 server/objects/files/AudioTrack.js (+2 -2)

📄 Description

Brief summary

API endpoints that return expanded Books and PodcastEpisodes include AudioTrack objects that have a contentUrl. That contentUrl was incorrectly including the basepath (/audiobookshelf). This PR removes the basepath from the API responses and prepends the basepath in the web client.

Which issue is fixed?

No issue

In-depth Description

The mobile clients and 3rd party clients will be getting users server address and prepending it to the contentUrl returned from the API.
If the contentUrl includes the basepath and the user includes the basepath in the address then it will result in track urls with /audiobookshelf/audiobookshelf/.

The mobile apps are currently falling back to transcoding if the user includes the basepath. This PR fixes that issue with no additional changes on the mobile apps.

How have you tested this?

Tested streaming on web client and mobile apps w/ subdir.


🔄 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/3921 **Author:** [@advplyr](https://github.com/advplyr) **Created:** 2/1/2025 **Status:** ✅ Merged **Merged:** 2/2/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `fix_content_url_basepath` --- ### 📝 Commits (1) - [`aebb3ff`](https://github.com/advplyr/audiobookshelf/commit/aebb3ff4137793ecb1ebaa9c9c6e667a35ba2edd) Fix API including basepath in tracks contentUrl ### 📊 Changes **6 files changed** (+16 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `client/pages/audiobook/_id/chapters.vue` (+1 -4) 📝 `client/players/AudioTrack.js` (+10 -3) 📝 `client/players/PlayerHandler.js` (+1 -1) 📝 `server/models/Book.js` (+1 -1) 📝 `server/models/PodcastEpisode.js` (+1 -1) 📝 `server/objects/files/AudioTrack.js` (+2 -2) </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 API endpoints that return expanded Books and PodcastEpisodes include AudioTrack objects that have a `contentUrl`. That `contentUrl` was incorrectly including the basepath (/audiobookshelf). This PR removes the basepath from the API responses and prepends the basepath in the web client. ## Which issue is fixed? No issue ## In-depth Description The mobile clients and 3rd party clients will be getting users server address and prepending it to the `contentUrl` returned from the API. If the `contentUrl` includes the basepath and the user includes the basepath in the address then it will result in track urls with `/audiobookshelf/audiobookshelf/`. The mobile apps are currently falling back to transcoding if the user includes the basepath. This PR fixes that issue with no additional changes on the mobile apps. ## How have you tested this? Tested streaming on web client and mobile apps w/ subdir. --- <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:23 +02:00
adam closed this issue 2026-04-25 00:18:24 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4121