From cc6a1473cbfb9c12a3972022ed32e6ac83c2c8eb Mon Sep 17 00:00:00 2001 From: Davide Bongiovanni Date: Tue, 13 Nov 2018 22:07:19 +0100 Subject: [PATCH] Correctly deleting existing datasheet --- parts/server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parts/server.py b/parts/server.py index dfdafa7..5b7d277 100644 --- a/parts/server.py +++ b/parts/server.py @@ -254,9 +254,9 @@ def alter(partID): datasheet_file.save('/srv/datasheets/' + datasheet_filename) datasheet_filename = 'http://elab.kth.se/parts/getfile/' + datasheet_filename if l[0]['datasheet'] != None: - os.remove('/srv/datasheets/' + l[0]['datasheet']) - # elif request.form.has_key('datasheet-url'): - # datasheet_filename = request.form['datasheet-url'] + whole_url = l[0]['datasheet'] + actual_filename = whole_url[whole_url.rfind('/') + 1:] + os.remove('/srv/datasheets/' + actual_filename) else: try: datasheet_filename = request.form['datasheet-url']