diff --git a/README.md b/README.md index 8e9e0d31..22f5068a 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,7 @@ some improvement ideas * is it possible to block read-access to folders unless you know the exact URL for a particular file inside? * yes, using the [`g` permission](#accounts-and-volumes), see the examples there + * you can also do this with linux filesystem permissions; `chmod 111 music` will make it possible to access files and folders inside the `music` folder but not list the immediate contents -- also works with other software, not just copyparty * can I make copyparty download a file to my server if I give it a URL? * not officially, but there is a [terrible hack](https://github.com/9001/copyparty/blob/hovudstraum/bin/mtag/wget.py) which makes it possible diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 988d5593..beeb4b71 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -794,6 +794,10 @@ class HttpCli(object): return True def handle_search(self, body): + idx = self.conn.get_u2idx() + if not hasattr(idx, "p_end"): + raise Pebkac(500, "sqlite3 is not available on the server; cannot search") + vols = [] seen = {} for vtop in self.rvol: @@ -805,7 +809,6 @@ class HttpCli(object): seen[vfs] = True vols.append([vfs.vpath, vfs.realpath, vfs.flags]) - idx = self.conn.get_u2idx() t0 = time.time() if idx.p_end: penalty = 0.7 @@ -1830,13 +1833,16 @@ class HttpCli(object): if not self.args.unpost: raise Pebkac(400, "the unpost feature is disabled in server config") + idx = self.conn.get_u2idx() + if not hasattr(idx, "p_end"): + raise Pebkac(500, "sqlite3 is not available on the server; cannot unpost") + filt = self.uparam.get("filter") lm = "ups [{}]".format(filt) self.log(lm) ret = [] t0 = time.time() - idx = self.conn.get_u2idx() lim = time.time() - self.args.unpost for vol in self.asrv.vfs.all_vols.values(): cur = idx.get_cur(vol.realpath)