improve UNC path handling (#2126)

always call 'abspath()' on the directory path to handle cases when the
current working directory is UNC and 'base-directory' is relative.
This commit is contained in:
Mike Fährmann
2021-12-30 22:22:19 +01:00
parent 47eae4c393
commit 3b7c7daa76
3 changed files with 5 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
# Changelog # Changelog
## Unreleased
## 1.20.0 - 2021-12-29 ## 1.20.0 - 2021-12-29
### Additions ### Additions
- [500px] add `favorite` extractor ([#1927](https://github.com/mikf/gallery-dl/issues/1927)) - [500px] add `favorite` extractor ([#1927](https://github.com/mikf/gallery-dl/issues/1927))

View File

@@ -178,10 +178,11 @@ class PathFormat():
if WINDOWS: if WINDOWS:
# Enable longer-than-260-character paths # Enable longer-than-260-character paths
directory = os.path.abspath(directory)
if directory.startswith("\\\\"): if directory.startswith("\\\\"):
directory = "\\\\?\\UNC\\" + directory[2:] directory = "\\\\?\\UNC\\" + directory[2:]
else: else:
directory = "\\\\?\\" + os.path.abspath(directory) directory = "\\\\?\\" + directory
# abspath() in Python 3.7+ removes trailing path separators (#402) # abspath() in Python 3.7+ removes trailing path separators (#402)
if directory[-1] != sep: if directory[-1] != sep:

View File

@@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation. # published by the Free Software Foundation.
__version__ = "1.20.0" __version__ = "1.20.1-dev"