UNC Path adds drive letter. [Bug]: #392

Closed
opened 2026-04-24 23:07:41 +02:00 by adam · 8 comments
Owner

Originally created by @MrKuenning on GitHub (May 29, 2022).

Describe the issue

A library located at \\NAS\Media\Audio\Library is being rewritten as "E:\\NAS\\Media\\Audio\\Library"

path: "E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 3 - It's a Dog's Life.m4b"

Resulting in scan errors:

Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\NAS\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 3 - It's a Dog's Life.m4b']
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: "E:\\NAS\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 3 - It's a Dog's Life.m4b"
}

Steps to reproduce the issue

  1. Add a new library from a UNC path.
  2. Scan library

Audiobookshelf version

Windows Build : v2.0.17

How are you running audiobookshelf?

Other

Originally created by @MrKuenning on GitHub (May 29, 2022). ### Describe the issue A library located at `\\NAS\Media\Audio\Library` is being rewritten as `"E:\\NAS\\Media\\Audio\\Library"` `path: "E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 3 - It's a Dog's Life.m4b"` Resulting in scan errors: ``` Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\NAS\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 3 - It's a Dog's Life.m4b'] errno: -4058, code: 'ENOENT', syscall: 'stat', path: "E:\\NAS\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 3 - It's a Dog's Life.m4b" } ``` ### Steps to reproduce the issue 1. Add a new library from a UNC path. 2. Scan library ### Audiobookshelf version Windows Build : v2.0.17 ### How are you running audiobookshelf? Other
adam added the bug label 2026-04-24 23:07:41 +02:00
adam closed this issue 2026-04-24 23:07:42 +02:00
Author
Owner

@advplyr commented on GitHub (May 29, 2022):

Abs is resolving relative paths and I think I'd like to keep it that way for now. Wouldn't a UNC path be entered with double backslashes like \\NAS\Media\etc?

I think it could check for a double slash before it resolves it. I'm not sure I don't use any UNC paths so let me know.

@advplyr commented on GitHub (May 29, 2022): Abs is resolving relative paths and I think I'd like to keep it that way for now. Wouldn't a UNC path be entered with double backslashes like `\\NAS\Media\etc`? I think it could check for a double slash before it resolves it. I'm not sure I don't use any UNC paths so let me know.
Author
Owner

@MrKuenning commented on GitHub (Jun 4, 2022):

Strange I typed it with two backslashes, but the github post formatting was removing the first one.
I added code markers so it will show up now.

It's basically taking a network SMB share and appending the drive letter that the exe file is located into the path.

@MrKuenning commented on GitHub (Jun 4, 2022): Strange I typed it with two backslashes, but the github post formatting was removing the first one. I added code markers so it will show up now. It's basically taking a network SMB share and appending the drive letter that the exe file is located into the path.
Author
Owner

@advplyr commented on GitHub (Jun 4, 2022):

Does that mean it is working now for you?

@advplyr commented on GitHub (Jun 4, 2022): Does that mean it is working now for you?
Author
Owner

@MrKuenning commented on GitHub (Jun 6, 2022):

No, I was just saying that I do have double back shashes. Git just made it look like I don't.

I downloaded the latest release v2.0.20 and it still fails to scan the library.
The strange thing is it lists all the files one by one and then says it can find that file because it cant be found.

@MrKuenning commented on GitHub (Jun 6, 2022): No, I was just saying that I do have double back shashes. Git just made it look like I don't. I downloaded the latest release v2.0.20 and it still fails to scan the library. The strange thing is it lists all the files one by one and then says it can find that file because it cant be found.
Author
Owner

@advplyr commented on GitHub (Jun 6, 2022):

What do you mean it lists all the files one by one?

It is adding the drive letter and still able to find that path?

@advplyr commented on GitHub (Jun 6, 2022): What do you mean it lists all the files one by one? It is adding the drive letter and still able to find that path?
Author
Owner

@MrKuenning commented on GitHub (Jun 7, 2022):

For example:
I have a SMB share on my NAS with the path \\Media\Media\Audio\Library - Audiobooks
In that share, I have a folder called Hank The Cowdog with multiple books in it.

\\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 1 - The Original Adventures.m4b
\\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 3 - It's a Dog's Life.m4b
\\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 7 - The Curse Of The Corncob.m4b

When I make a new library and point it at the Audiobook folder I get the following errors listed in the console:

Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 1 - The Original Adventures.m4b'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 1 - The Original Adventures.m4b'
}
Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 7 - The Curse Of The Incredible Priceless Corncob.m4b'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: 'E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 7 - The Curse Of The  Corncob.m4b'
}
Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 3 - It's a Dog's Life.m4b'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'stat',
  path: "E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 3 - It's a Dog's Life.m4b"
}

So it appends an "E" and then lists the files that are there and says they can't be found. Nothing shows up in the library.

@MrKuenning commented on GitHub (Jun 7, 2022): For example: I have a SMB share on my NAS with the path `\\Media\Media\Audio\Library - Audiobooks` In that share, I have a folder called `Hank The Cowdog` with multiple books in it. ``` \\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 1 - The Original Adventures.m4b \\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 3 - It's a Dog's Life.m4b \\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 7 - The Curse Of The Corncob.m4b ``` When I make a new library and point it at the Audiobook folder I get the following errors listed in the console: ``` Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 1 - The Original Adventures.m4b'] { errno: -4058, code: 'ENOENT', syscall: 'stat', path: 'E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 1 - The Original Adventures.m4b' } Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 7 - The Curse Of The Incredible Priceless Corncob.m4b'] { errno: -4058, code: 'ENOENT', syscall: 'stat', path: 'E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 7 - The Curse Of The Corncob.m4b' } Failed to getFileTimestampsWithIno [Error: ENOENT: no such file or directory, stat 'E:\Media\Media\Audio\Library - Audiobooks\Hank The Cowdog\Hank The Cowdog - 3 - It's a Dog's Life.m4b'] { errno: -4058, code: 'ENOENT', syscall: 'stat', path: "E:\\Media\\Media\\Audio\\Library - Audiobooks\\Hank The Cowdog\\Hank The Cowdog - 3 - It's a Dog's Life.m4b" } ``` So it appends an "E" and then lists the files that are there and says they can't be found. Nothing shows up in the library.
Author
Owner

@mikiher commented on GitHub (Aug 6, 2024):

I can confirm I can reproduce this.

This was reported again in a couple of recent discussions in audiobookshelf-windows (1, 2)

I believe this is due to posix path normalization - I think it works well for every Windows path except for UNC paths - those must start with a double backslash, and replacing it with a double slash is messing the path up, and I believe is causing path methods (like join, resolve, relaltive, and maybe others) to behave incorrectly.

I'm going to look into fixing this.

@mikiher commented on GitHub (Aug 6, 2024): I can confirm I can reproduce this. This was reported again in a couple of recent discussions in audiobookshelf-windows ([1](https://github.com/mikiher/audiobookshelf-windows/discussions/20), [2](https://github.com/mikiher/audiobookshelf-windows/discussions/21)) I believe this is due to posix path normalization - I think it works well for every Windows path _except_ for UNC paths - those must start with a double backslash, and replacing it with a double slash is messing the path up, and I believe is causing path methods (like join, resolve, relaltive, and maybe others) to behave incorrectly. I'm going to look into fixing this.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 9, 2024):

Fixed in v2.12.2.

@github-actions[bot] commented on GitHub (Aug 9, 2024): Fixed in [v2.12.2](https://github.com/advplyr/audiobookshelf/releases/tag/v2.12.2).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#392