mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
mkdir fixes
This commit is contained in:
parent
10652427bc
commit
bf0aac2cbd
|
@ -141,9 +141,9 @@ class AuthSrv(object):
|
|||
self.warn_anonwrite = True
|
||||
|
||||
if WINDOWS:
|
||||
self.re_vol = re.compile(r'^([a-zA-Z]:[\\/][^:]*|[^:]*):([^:]*):(.*)')
|
||||
self.re_vol = re.compile(r"^([a-zA-Z]:[\\/][^:]*|[^:]*):([^:]*):(.*)")
|
||||
else:
|
||||
self.re_vol = re.compile(r'^([^:]*):([^:]*):(.*)')
|
||||
self.re_vol = re.compile(r"^([^:]*):([^:]*):(.*)")
|
||||
|
||||
self.mutex = threading.Lock()
|
||||
self.reload()
|
||||
|
@ -230,7 +230,7 @@ class AuthSrv(object):
|
|||
try:
|
||||
src, dst, perms = vol_match.groups()
|
||||
except:
|
||||
raise Exception('invalid -v argument')
|
||||
raise Exception("invalid -v argument")
|
||||
|
||||
src = fsdec(os.path.abspath(fsenc(src)))
|
||||
dst = dst.strip("/")
|
||||
|
@ -275,12 +275,12 @@ class AuthSrv(object):
|
|||
v.uwrite = mwrite[dst]
|
||||
|
||||
try:
|
||||
vfs.get("/", "*", False, True)
|
||||
if self.warn_anonwrite:
|
||||
v, _ = vfs.get("/", "*", False, True)
|
||||
if self.warn_anonwrite and os.getcwd() == v.realpath:
|
||||
self.warn_anonwrite = False
|
||||
self.log(
|
||||
"\033[31manyone can read/write the current directory: {}\033[0m".format(
|
||||
os.getcwd()
|
||||
v.realpath
|
||||
)
|
||||
)
|
||||
except Pebkac:
|
||||
|
|
|
@ -384,13 +384,21 @@ class HttpCli(object):
|
|||
fn = os.path.join(fdir, sanitize_fn(new_dir))
|
||||
|
||||
if not os.path.isdir(fsenc(fdir)):
|
||||
raise Pebkac(404, "that folder does not exist")
|
||||
raise Pebkac(500, "parent folder does not exist")
|
||||
|
||||
if os.path.isdir(fsenc(fn)):
|
||||
raise Pebkac(500, "that folder exists already")
|
||||
|
||||
try:
|
||||
os.mkdir(fsenc(fn))
|
||||
except:
|
||||
raise Pebkac(500, "mkdir failed, check the logs")
|
||||
|
||||
vpath = "{}/{}".format(self.vpath, new_dir).lstrip("/")
|
||||
redir = '<script>document.getElementsByTagName("a")[0].click()</script>'
|
||||
html = self.conn.tpl_msg.render(
|
||||
h2='<a href="/{}">return to /{}</a>'.format(
|
||||
quotep(self.vpath), html_escape(self.vpath, quote=False)
|
||||
h2='<a href="/{}">go to /{}</a>{}'.format(
|
||||
quotep(vpath), html_escape(vpath, quote=False), redir
|
||||
),
|
||||
pre="aight",
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue