Skip to content

Commit

Permalink
v1.8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Jul 18, 2023
1 parent 491803d commit 1441cce
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions copyparty/__version__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# coding: utf-8

VERSION = (1, 8, 3)
VERSION = (1, 8, 4)
CODENAME = "argon"
BUILD_DT = (2023, 7, 16)
BUILD_DT = (2023, 7, 18)

S_VERSION = ".".join(map(str, VERSION))
S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT)
Expand Down
1 change: 1 addition & 0 deletions copyparty/cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def vf_cmap() -> dict[str, str]:
"nohash=\\.iso$": "skips hashing file contents if path matches *.iso",
"noidx=\\.iso$": "fully ignores the contents at paths matching *.iso",
"noforget": "don't forget files when deleted from disk",
"fat32": "avoid excessive reindexing on android sdcardfs",
"dbd=[acid|swal|wal|yolo]": "database speed-durability tradeoff",
"xlink": "cross-volume dupe detection / linking",
"xdev": "do not descend into other filesystems",
Expand Down
6 changes: 3 additions & 3 deletions copyparty/httpcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3126,7 +3126,7 @@ def on40x(self, mods: list[str], vn: VFS, rem: str) -> str:
return "" # unhandled / fallthrough

def scanvol(self) -> bool:
if not self.can_read or not self.can_write:
if not self.can_admin:
raise Pebkac(403, "not allowed for user " + self.uname)

if self.args.no_rescan:
Expand All @@ -3149,7 +3149,7 @@ def handle_reload(self) -> bool:
if act != "cfg":
raise Pebkac(400, "only config files ('cfg') can be reloaded rn")

if not [x for x in self.wvol if x in self.rvol]:
if not self.avol:
raise Pebkac(403, "not allowed for user " + self.uname)

if self.args.no_reload:
Expand All @@ -3159,7 +3159,7 @@ def handle_reload(self) -> bool:
return self.redirect("", "?h", x.get(), "return to", False)

def tx_stack(self) -> bool:
if not [x for x in self.wvol if x in self.rvol]:
if not self.avol and not [x for x in self.wvol if x in self.rvol]:
raise Pebkac(403, "not allowed for user " + self.uname)

if self.args.no_stack:
Expand Down
19 changes: 17 additions & 2 deletions copyparty/up2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,7 @@ def _build_file_index(self, vol: VFS, all_vols: list[VFS]) -> tuple[bool, bool]:
rei = vol.flags.get("noidx")
reh = vol.flags.get("nohash")
n4g = bool(vol.flags.get("noforget"))
ffat = "fat32" in vol.flags
cst = bos.stat(top)
dev = cst.st_dev if vol.flags.get("xdev") else 0

Expand Down Expand Up @@ -919,6 +920,7 @@ def _build_file_index(self, vol: VFS, all_vols: list[VFS]) -> tuple[bool, bool]:
rei,
reh,
n4g,
ffat,
[],
cst,
dev,
Expand Down Expand Up @@ -974,6 +976,7 @@ def _build_dir(
rei: Optional[Pattern[str]],
reh: Optional[Pattern[str]],
n4g: bool,
ffat: bool,
seen: list[str],
cst: os.stat_result,
dev: int,
Expand Down Expand Up @@ -1018,7 +1021,7 @@ def _build_dir(

lmod = int(inf.st_mtime)
sz = inf.st_size
if fat32 and inf.st_mtime % 2:
if fat32 and not ffat and inf.st_mtime % 2:
fat32 = False

if stat.S_ISDIR(inf.st_mode):
Expand All @@ -1035,7 +1038,19 @@ def _build_dir(
# self.log(" dir: {}".format(abspath))
try:
ret += self._build_dir(
db, top, excl, abspath, rap, rei, reh, n4g, seen, inf, dev, xvol
db,
top,
excl,
abspath,
rap,
rei,
reh,
n4g,
fat32,
seen,
inf,
dev,
xvol,
)
except:
t = "failed to index subdir [{}]:\n{}"
Expand Down

0 comments on commit 1441cce

Please sign in to comment.