be case-sensitive on windows/macos (closes #781);

on Windows and Macos, most filesystems are case-insensitive,
which can lead to dangerous situations

one example is when another program (not copyparty or its UI) wants to
rename a file from `Foo` to `foo`; the program will probably start by
checking if `foo` exists and then delete it, however this would match
`Foo` and confuse the program into deleting the wrong file

fix this by adding a VERY EXPENSIVE detector to prevent this,
by listing the parent folder and checking if the case matches

this check will auto-enable when a case-insensitive FS is detected on
startup, but option `casechk` (global or volflag) can override this
This commit is contained in:
ed
2025-09-14 23:39:46 +00:00
parent 3a2381ff2d
commit 8b66874b85
8 changed files with 103 additions and 7 deletions

View File

@@ -735,6 +735,9 @@ class HttpCli(object):
else:
avn = vn
if "bcasechk" in vn.flags and not vn.casechk(rem, True):
return self.tx_404() and False
(
self.can_read,
self.can_write,