diff --git a/copyparty/__main__.py b/copyparty/__main__.py index fd2424d4..b7f5c727 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -355,12 +355,14 @@ def run_argparse(argv, formatter): ap2.add_argument("-nih", action="store_true", help="no info hostname") ap2.add_argument("-nid", action="store_true", help="no info disk-usage") ap2.add_argument("--no-zip", action="store_true", help="disable download as zip/tar") - ap2.add_argument("--no-logues", action="store_true", help="disable rendering .prologue/.epilogue.html into directory listings") ap2.add_argument("--no-lifetime", action="store_true", help="disable automatic deletion of uploads after a certain time (lifetime volflag)") ap2 = ap.add_argument_group('safety options') ap2.add_argument("--ls", metavar="U[,V[,F]]", type=u, help="scan all volumes; arguments USER,VOL,FLAGS; example [**,*,ln,p,r]") ap2.add_argument("--salt", type=u, default="hunter2", help="up2k file-hash salt") + ap2.add_argument("--no-dot-mv", action="store_true", help="disallow moving dotfiles; makes it impossible to move folders containing dotfiles") + ap2.add_argument("--no-dot-ren", action="store_true", help="disallow renaming dotfiles; makes it impossible to make something a dotfile") + ap2.add_argument("--no-logues", action="store_true", help="disable rendering .prologue/.epilogue.html into directory listings") ap2 = ap.add_argument_group('logging options') ap2.add_argument("-q", action="store_true", help="quiet") diff --git a/copyparty/up2k.py b/copyparty/up2k.py index a7901dd8..0b23c1dc 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -1520,6 +1520,14 @@ class Up2k(object): dabs = dvn.canonical(drem) drd, dfn = vsplit(drem) + n1 = svp.split('/')[-1] + n2 = dvp.split('/')[-1] + if n1.startswith('.') or n2.startswith('.'): + if self.args.no_dot_mv: + raise Pebkac(400, "moving dotfiles was disabled by server config") + elif self.args.no_dot_ren and n1 != n2: + raise Pebkac(400, "renaming dotfiles was disabled by server config") + if bos.path.exists(dabs): raise Pebkac(400, "mv2: target file exists")