diff --git a/server.py b/server.py
index a8e83b4..1f617d2 100644
--- a/server.py
+++ b/server.py
@@ -98,7 +98,8 @@ def alter(partID):
datasheet_file = request.files['datasheet-file']
datasheet_filename = secure_filename(datasheet_file.filename)
datasheet_file.save('/srv/datasheets/' + datasheet_filename)
- os.remove('/srv/datasheets/' + l[0]['datasheet'])
+ if l[0]['datasheet'] != None:
+ os.remove('/srv/datasheets/' + l[0]['datasheet'])
else:
datasheet_filename = l[0]['datasheet']
s += 'where id=:id;'
diff --git a/static/script.js b/static/script.js
index 9916154..7c18832 100644
--- a/static/script.js
+++ b/static/script.js
@@ -203,7 +203,7 @@ function show_part_info(partID) {
$('#quantity-info').text(text_filter(data.quantity));
$('#notes-info').text(text_filter(data.notes));
if (data.datasheet != null)
- $('#datasheet-info').append($(''));
+ $('#datasheet-info').html($(''));
else
$('#datasheet-info').text(' ');
$('#edit-button').click(function() {