mirror of
https://github.com/9001/copyparty.git
synced 2025-08-16 08:32:13 -06:00
patch pyftpdlib, fixes #539
upgrading pyftpdlib brings only pain and no benefits so grafting a patch for this instead
This commit is contained in:
parent
3c78c6a880
commit
8ba98877ee
|
@ -217,6 +217,7 @@ necho() {
|
|||
tar -zxf $f
|
||||
mv pyftpdlib-*/pyftpdlib .
|
||||
rm -rf pyftpdlib-* pyftpdlib/test
|
||||
patch -p1 <../scripts/patches/pyftpdlib-win313.patch
|
||||
for f in pyftpdlib/_async{hat,ore}.py; do
|
||||
[ -e "$f" ] || continue;
|
||||
iawk 'NR<4||NR>27||!/^#/;NR==4{print"# license: https://opensource.org/licenses/ISC\n"}' $f
|
||||
|
|
41
scripts/patches/pyftpdlib-win313.patch
Normal file
41
scripts/patches/pyftpdlib-win313.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
Date: Tue, 22 Oct 2024 12:47:30 +0200
|
||||
Subject: Workaround for isabs() on Windows + Python 3.13 (#652)
|
||||
|
||||
Starting from Python 3.13, `os.path.isabs("/foo")` on Windows return `False`
|
||||
|
||||
diff --git a/pyftpdlib/filesystems.py b/pyftpdlib/filesystems.py
|
||||
index 9b9326bf..320ffe40 100644
|
||||
--- a/pyftpdlib/filesystems.py
|
||||
+++ b/pyftpdlib/filesystems.py
|
||||
@@ -132,6 +132,16 @@ def cwd(self, path):
|
||||
|
||||
# --- Pathname / conversion utilities
|
||||
|
||||
+ @staticmethod
|
||||
+ def _isabs(path, _windows=os.name == "nt"):
|
||||
+ # Windows + Python 3.13: isabs() changed so that a path
|
||||
+ # starting with "/" is no longer considered absolute.
|
||||
+ # https://github.com/python/cpython/issues/44626
|
||||
+ # https://github.com/python/cpython/pull/113829/
|
||||
+ if _windows and path.startswith("/"):
|
||||
+ return True
|
||||
+ return os.path.isabs(path)
|
||||
+
|
||||
def ftpnorm(self, ftppath):
|
||||
"""Normalize a "virtual" ftp pathname (typically the raw string
|
||||
coming from client) depending on the current working directory.
|
||||
@@ -146,3 +156,3 @@
|
||||
assert isinstance(ftppath, unicode), ftppath
|
||||
- if os.path.isabs(ftppath):
|
||||
+ if self._isabs(ftppath):
|
||||
p = os.path.normpath(ftppath)
|
||||
@@ -162,3 +172,3 @@
|
||||
# This is for extra protection, maybe not really necessary.
|
||||
- if not os.path.isabs(p):
|
||||
+ if not self._isabs(p):
|
||||
p = u("/")
|
||||
@@ -201,3 +211,3 @@
|
||||
assert isinstance(fspath, unicode), fspath
|
||||
- if os.path.isabs(fspath):
|
||||
+ if self._isabs(fspath):
|
||||
p = os.path.normpath(fspath)
|
Loading…
Reference in a new issue