-
-
Notifications
You must be signed in to change notification settings - Fork 996
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
Windows host base-location for network share not working #2113
Comments
Well, yes, running gallery-dl in Is possible to concat |
AlttiRI, thanks for the references. I did more tests and found that "\?\UNC\server\share" works! Valid, working example:
But I don't see how to make the current code produce this format. Currently, if the host is on Windows:
This option:
Won't work. The abspath() function wants to add a drive letter to the directory value, which will never work for a shared and unmapped directory. |
let directory;
directory = "//KEENETIC/USB";
//directory = "./";
directory = path.resolve(directory);
directory = directory.startsWith("\\\\") ? "\\\\?\\UNC" + directory.slice(1) : "\\\\?\\" + directory;
console.log(directory);
console.log(await fs.readdir(directory)); |
Is there a python equivalent (I'm not finding path.resolve() ) |
Something like gallery-dl/gallery_dl/cache.py Line 209 in 0d02a78
|
Should be fixed with the changes in ac80474
Maybe in older Python versions. In 3.10 it works as expected with UNC paths >>> import ntpath
>>> ntpath.abspath("//server/share/foobar")
'\\\\server\\share\\foobar'
>>> ntpath.abspath("\\\\?\\UNC\\server\\share\\foobar")
'\\\\?\\UNC\\server\\share\\foobar'
>>>
|
With python 3.10, the changes in ac80474 work. Thanks! |
Problem: Windows host, target directory (base-location) cannot be a UNC-style path, e.g. \foo.bar\baz or //foo.bar/baz.
I have tried using the --option base-location=//foo.bar/baz CLI method various different ways with no luck. Using a json config file doesn't work either.
Discovered: The function gallery_dl.path.PathFormat.set_directory (path.py line 179) attempts to adjust for Windows path limits, but it messes up the directory.
For example, if directory is '//foo.bar/baz', then it gets converted to '\?\\foo.bar\baz' and this does not work on Windows 11.
Problem code:
Python docs explain that os.path.abspath() is to convert a relative path to an absolute path. The UNC example is not a relative path, so it is not surprising this fails.
I'm not sure how the path limit should work on Windows, but here's what I'm doing:
Since my UNC paths are nowhere near this limit, this works for me!
The text was updated successfully, but these errors were encountered: