diff options
-rwxr-xr-x | fshare.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -148,7 +148,8 @@ class FShareRequestHandler(hs.BaseHTTPRequestHandler): def do_GET(self): self._log_request() - fname = self._process_path(self.path) + # discard any extension + fname = os.path.splitext(self._process_path(self.path))[0] path = '/'.join((self.server.data_dir, fname)) self._logger.info('serve file: %s', fname) @@ -205,7 +206,7 @@ class FShareRequestHandler(hs.BaseHTTPRequestHandler): os.close(temp_fd) - dst_fname = h.hexdigest() + ext + dst_fname = h.hexdigest() self._logger.info('Received file: %s', dst_fname) outpath = '/'.join((self.server.data_dir, dst_fname)) @@ -224,7 +225,8 @@ class FShareRequestHandler(hs.BaseHTTPRequestHandler): except KeyError: host = 'host.missing' - reply = ('https://%s/%s' % (host, dst_fname)).encode('ascii') + path = urlparse.quote(dst_fname + ext) + reply = ('https://%s/%s' % (host, path)).encode('ascii') self.send_response(retcode) self.send_header('Content-Type', 'text/plain') |