diff --git a/copyparty/__version__.py b/copyparty/__version__.py index 42363439..6345518a 100644 --- a/copyparty/__version__.py +++ b/copyparty/__version__.py @@ -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) diff --git a/copyparty/cfg.py b/copyparty/cfg.py index 818955fd..7618324c 100644 --- a/copyparty/cfg.py +++ b/copyparty/cfg.py @@ -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", diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index c9d2a1aa..c2aea8cc 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -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: @@ -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: @@ -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: diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 044bdcb7..08d83b70 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -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 @@ -919,6 +920,7 @@ def _build_file_index(self, vol: VFS, all_vols: list[VFS]) -> tuple[bool, bool]: rei, reh, n4g, + ffat, [], cst, dev, @@ -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, @@ -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): @@ -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{}"