Skip to content

Commit

Permalink
detect invalid config (prevent db loss)
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Nov 15, 2024
1 parent 1f17752 commit 2b63d7d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion copyparty/authsrv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,18 @@ def _reload(self, verbosity: int = 9) -> None:

self.log("\n\n".join(ta) + "\n", c=3)

vfs.histtab = {zv.realpath: zv.histpath for zv in vfs.all_vols.values()}
rhisttab = {}
vfs.histtab = {}
for zv in vfs.all_vols.values():
histp = zv.histpath
if histp in rhisttab:
zv2 = rhisttab[histp]
t = "invalid config; multiple volumes share the same histpath (database location):\n histpath: %s\n volume 1: /%s [%s]\n volume 2: %s [%s]"
t = t % (histp, zv2.vpath, zv2.realpath, zv.vpath, zv.realpath)
self.log(t, 1)
raise Exception(t)
rhisttab[histp] = zv
vfs.histtab[zv.realpath] = histp

for vol in vfs.all_vols.values():
lim = Lim(self.log_func)
Expand Down

0 comments on commit 2b63d7d

Please sign in to comment.