mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
more fun with symlinks
This commit is contained in:
parent
118bdcc26e
commit
12219c1bea
|
@ -447,11 +447,20 @@ class VFS(object):
|
|||
|
||||
def canonical(self, rem: str, resolve: bool = True) -> str:
|
||||
"""returns the canonical path (fully-resolved absolute fs path)"""
|
||||
rp = self.realpath
|
||||
ap = self.realpath
|
||||
if rem:
|
||||
rp += "/" + rem
|
||||
ap += "/" + rem
|
||||
|
||||
return absreal(rp) if resolve else rp
|
||||
return absreal(ap) if resolve else ap
|
||||
|
||||
def dcanonical(self, rem: str) -> str:
|
||||
"""resolves until the final component (filename)"""
|
||||
ap = self.realpath
|
||||
if rem:
|
||||
ap += "/" + rem
|
||||
|
||||
ad, fn = os.path.split(ap)
|
||||
return os.path.join(absreal(ad), fn)
|
||||
|
||||
def ls(
|
||||
self,
|
||||
|
|
|
@ -2491,7 +2491,7 @@ class HttpCli(object):
|
|||
vpnodes.append([quotep(vpath) + "/", html_escape(node, crlf=True)])
|
||||
|
||||
vn, rem = self.asrv.vfs.get(self.vpath, self.uname, False, False)
|
||||
abspath = vn.canonical(rem)
|
||||
abspath = vn.dcanonical(rem)
|
||||
dbv, vrem = vn.get_dbv(rem)
|
||||
|
||||
try:
|
||||
|
|
|
@ -1330,8 +1330,24 @@ def gen_filekey_dbg(
|
|||
|
||||
assert log_ptn
|
||||
if log_ptn.search(fspath):
|
||||
t = "fk({}) salt({}) size({}) inode({}) fspath({})"
|
||||
log(t.format(ret[:8], salt, fsize, inode, fspath))
|
||||
try:
|
||||
import inspect
|
||||
|
||||
ctx = ",".join(inspect.stack()[n][3] for n in range(2, 5))
|
||||
except:
|
||||
ctx = ""
|
||||
|
||||
try:
|
||||
p2 = "a"
|
||||
p2 = absreal(fspath)
|
||||
if p2 != fspath:
|
||||
raise Exception()
|
||||
except:
|
||||
t = "maybe wrong abspath for filekey;\norig: {}\nreal: {}"
|
||||
log(t.format(fspath, p2), 1)
|
||||
|
||||
t = "fk({}) salt({}) size({}) inode({}) fspath({}) at({})"
|
||||
log(t.format(ret[:8], salt, fsize, inode, fspath, ctx), 5)
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Reference in a new issue