Skip to content

Commit

Permalink
dirkeys: fix 403 in dks volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
9001 committed Mar 27, 2024
1 parent 32c912b commit ef52e2c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions copyparty/httpcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2875,7 +2875,7 @@ def _chk_lastmod(self, file_ts: int) -> tuple[str, bool]:

return file_lastmod, True

def _use_dirkey(self, ap: str = "", throw: bool = False) -> bool:
def _use_dirkey(self, ap: str = "") -> bool:
if self.can_read or not self.can_get:
return False

Expand All @@ -2894,9 +2894,6 @@ def _use_dirkey(self, ap: str = "", throw: bool = False) -> bool:

t = "wrong dirkey, want %s, got %s\n vp: %s\n ap: %s"
self.log(t % (zs, req, self.req, ap), 6)
if throw:
raise Pebkac(403)

return False

def _expand(self, txt: str, phs: list[str]) -> str:
Expand Down Expand Up @@ -3608,8 +3605,7 @@ def gen_tree(self, top: str, target: str, dk: str) -> dict[str, Any]:
dk_sz = False
if dk:
vn, rem = vfs.get(top, self.uname, False, False)
if vn.flags.get("dks"):
self._use_dirkey(vn.canonical(rem), True)
if vn.flags.get("dks") and self._use_dirkey(vn.canonical(rem)):
dk_sz = vn.flags.get("dk")

dots = False
Expand All @@ -3623,7 +3619,9 @@ def gen_tree(self, top: str, target: str, dk: str) -> dict[str, Any]:
[[True, False], [False, True]],
)
dots = self.uname in vn.axs.udot
dk_sz = vn.flags.get("dk")
except:
dk_sz = None
vfs_ls = []
vfs_virt = {}
for v in self.rvol:
Expand Down

0 comments on commit ef52e2c

Please sign in to comment.