Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MrKuenning opened this issue May 29, 2022 · 8 comments · Fixed by #3254
Closed

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

MrKuenning opened this issue May 29, 2022 · 8 comments · Fixed by #3254
Labels
bug Something isn't working

Comments

@MrKuenning
Copy link

MrKuenning commented 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

@MrKuenning MrKuenning added the bug Something isn't working label May 29, 2022
@advplyr
Copy link
Owner

advplyr commented 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.

@MrKuenning
Copy link
Author

MrKuenning commented 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.

@advplyr
Copy link
Owner

advplyr commented Jun 4, 2022

Does that mean it is working now for you?

@MrKuenning
Copy link
Author

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.

@advplyr
Copy link
Owner

advplyr commented Jun 5, 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?

@MrKuenning
Copy link
Author

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.

@mikiher
Copy link
Contributor

mikiher commented 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.

@advplyr advplyr added the awaiting release Issue is resolved and will be in the next release label Aug 8, 2024
Copy link

github-actions bot commented Aug 8, 2024

Fixed in v2.12.2.

@github-actions github-actions bot removed the awaiting release Issue is resolved and will be in the next release label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants