[Bug]: Invalid cover path crashes container #1319

Closed
opened 2026-04-24 23:39:35 +02:00 by adam · 4 comments
Owner

Originally created by @engirugger42 on GitHub (Aug 14, 2023).

Describe the issue

Editing the cover path to a directory causes the container to crash. Visually, the web app just shows the socket connection failed. I have also tested this with non-image files and files that do not exist, both of these cases are handled correctly. Logs attached.
audiobookshelf-logs.txt
Edit: Debug logs
audiobookshelf-debug-logs.txt

socket connection failed

Steps to reproduce the issue

  1. Go to any audio book, with or without cover art.
  2. Click the edit cover art button.
  3. Change to the path to a directory
  4. Click Save

Audiobookshelf version

2.3.3

How are you running audiobookshelf?

Docker

Originally created by @engirugger42 on GitHub (Aug 14, 2023). ### Describe the issue Editing the cover path to a directory causes the container to crash. Visually, the web app just shows the socket connection failed. I have also tested this with non-image files and files that do not exist, both of these cases are handled correctly. Logs attached. [audiobookshelf-logs.txt](https://github.com/advplyr/audiobookshelf/files/12338383/audiobookshelf-logs.txt) Edit: Debug logs [audiobookshelf-debug-logs.txt](https://github.com/advplyr/audiobookshelf/files/12338533/audiobookshelf-debug-logs.txt) ![socket connection failed](https://github.com/advplyr/audiobookshelf/assets/18199813/ab52665d-8062-456a-95c2-0823bc8bdd51) ### Steps to reproduce the issue 1. Go to any audio book, with or without cover art. 2. Click the edit cover art button. 3. Change to the path to a directory 4. Click Save ### Audiobookshelf version 2.3.3 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:39:35 +02:00
adam closed this issue 2026-04-24 23:39:36 +02:00
Author
Owner

@advplyr commented on GitHub (Aug 24, 2023):

The error log isn't giving us anything useful to go off of. I just tested putting in a bad path, putting in a good path, and putting in a URL to an image. All of those worked properly.

When putting in a path that doesn't exist the server shows this error:

[2023-08-23 17:40:22] ERROR: [CoverManager] validate cover path does not exist "/path/that/does/not/exist/test.png" (CoverManager.js:185)

And I get
image

Can you give more specific details on how to reproduce this error?

@advplyr commented on GitHub (Aug 24, 2023): The error log isn't giving us anything useful to go off of. I just tested putting in a bad path, putting in a good path, and putting in a URL to an image. All of those worked properly. When putting in a path that doesn't exist the server shows this error: ``` [2023-08-23 17:40:22] ERROR: [CoverManager] validate cover path does not exist "/path/that/does/not/exist/test.png" (CoverManager.js:185) ``` And I get ![image](https://github.com/advplyr/audiobookshelf/assets/67830747/615e882e-ea60-4695-b7e2-54c22344f063) Can you give more specific details on how to reproduce this error?
Author
Owner

@engirugger42 commented on GitHub (Aug 27, 2023):

Sure thing. Specifically, a path ending in a directory with a / is what broke it for me. Visual example:
directory-path

Hitting save at this point will cause a socket disconnect. I just recreated this to get double check, and the container managed to recover, which is not what I observed 2 weeks ago. I have not changed versions in that time, so perhaps I just wasn't patient enough with the container before or my server was just having an off day, in which case this can be closed.

For what its worth, I did some digging in the repo and I believe it's coming from this method in fileUtils when called from this method in CoverManager. I've never been much of a JS guy, much less using the larger frameworks, so apologies if that's not a particularly helpful suggestion.

@engirugger42 commented on GitHub (Aug 27, 2023): Sure thing. Specifically, a path ending in a directory with a `/` is what broke it for me. Visual example: ![directory-path](https://github.com/advplyr/audiobookshelf/assets/18199813/aaa4b25d-bd86-4234-b6a8-9b7cc31ba6a5) Hitting save at this point will cause a socket disconnect. I just recreated this to get double check, and the container managed to recover, which is not what I observed 2 weeks ago. I have not changed versions in that time, so perhaps I just wasn't patient enough with the container before or my server was just having an off day, in which case this can be closed. For what its worth, I did some digging in the repo and I believe it's coming from [this method in fileUtils](https://github.com/advplyr/audiobookshelf/blob/6d6e8613cfd6023493bd559aa3e317313712a295/server/utils/fileUtils.js#L177) when called from [this method in CoverManager](https://github.com/advplyr/audiobookshelf/blob/ea1d051cfb04704a7b2ac384d6d205195def78b5/server/managers/CoverManager.js#L121). I've never been much of a JS guy, much less using the larger frameworks, so apologies if that's not a particularly helpful suggestion.
Author
Owner

@advplyr commented on GitHub (Aug 31, 2023):

I was able to reproduce this. It is specific to entering a file path that exists but is not a file. I fixed it by checking that the path is a file and not a directory.

@advplyr commented on GitHub (Aug 31, 2023): I was able to reproduce this. It is specific to entering a file path that exists but is not a file. I fixed it by checking that the path is a file and not a directory.
Author
Owner

@advplyr commented on GitHub (Sep 10, 2023):

Fixed in v2.4.0

@advplyr commented on GitHub (Sep 10, 2023): Fixed in [v2.4.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.4.0)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1319