From 4db4b6b8477605442c71f768dbb26ee7c659bef2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Dec 2023 20:39:34 +0100 Subject: Implement DELETE in public mode. Reprted by another. --- fshare.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fshare.py b/fshare.py index ec94b2b..f6e6304 100755 --- a/fshare.py +++ b/fshare.py @@ -482,6 +482,15 @@ class FShareRequestHandler(hs.BaseHTTPRequestHandler): fname = self._process_path(self.path) + if self.server.state.urlmap: + try: + short = self.server.state.urlmap.short_to_full(fname) + self._logger.info('%s->%s', fname, short) + fname = short + except KeyError: + self._logger.error('DELETE request for non-existing file: %s', fname) + return self.send_error(HTTPStatus.NOT_FOUND) + local_path = '/'.join((self.server.data_dir, fname)) try: os.remove(local_path) -- cgit v1.2.3