diff options
Diffstat (limited to 'fshare.py')
-rwxr-xr-x | fshare.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -171,6 +171,9 @@ class FShareRequestHandler(hs.BaseHTTPRequestHandler): def do_POST(self): self._log_request() + src_fname = self._process_path(self.path) + ext = os.path.splitext(src_fname)[1] + if 'Transfer-Encoding' in self.headers: if self.headers['Transfer-Encoding'] != 'chunked': return self.send_error(HTTPStatus.NOT_IMPLEMENTED, @@ -202,10 +205,10 @@ class FShareRequestHandler(hs.BaseHTTPRequestHandler): os.close(temp_fd) - fname = h.hexdigest() - self._logger.info('Received file: %s', fname) + dst_fname = h.hexdigest() + ext + self._logger.info('Received file: %s', dst_fname) - outpath = '/'.join((self.server.data_dir, fname)) + outpath = '/'.join((self.server.data_dir, dst_fname)) if os.path.exists(outpath): retcode = HTTPStatus.OK os.remove(temp_path) @@ -221,7 +224,7 @@ class FShareRequestHandler(hs.BaseHTTPRequestHandler): except KeyError: host = 'host.missing' - reply = ('https://%s/%s' % (host, fname)).encode('ascii') + reply = ('https://%s/%s' % (host, dst_fname)).encode('ascii') self.send_response(retcode) self.send_header('Content-Type', 'text/plain') |