Commit 9afa96a9 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Fix check of extension for uploaded files, Fixes #37

parent 5ebd10c8
......@@ -44,10 +44,21 @@ dgenies.run.init_fileuploads = function () {
);
},
success: function (data, success) {
$("input#query").val(data["files"][0]["name"]);
dgenies.run.hide_loading("query");
dgenies.run.show_success("query");
dgenies.run.upload_next();
if (data["success"] !== "OK") {
dgenies.notify("message" in data ? data["message"]: "An error has occured when uploading query file!",
"error");
dgenies.run.enable_form();
}
else if ("error" in data["files"][0]) {
dgenies.run.add_error("Query file: " + data["files"][0]["error"], "error");
dgenies.run.enable_form();
}
else {
$("input#query").val(data["files"][0]["name"]);
dgenies.run.hide_loading("query");
dgenies.run.show_success("query");
dgenies.run.upload_next();
}
}
});
$('input.file-target').fileupload({
......@@ -64,10 +75,21 @@ dgenies.run.init_fileuploads = function () {
);
},
success: function (data, success) {
$("input#target").val(data["files"][0]["name"]);
dgenies.run.hide_loading("target");
dgenies.run.show_success("target");
dgenies.run.upload_next();
if (data["success"] !== "OK") {
dgenies.notify("message" in data ? data["message"]: "An error has occured when uploading target file!",
"error");
dgenies.run.enable_form();
}
else if ("error" in data["files"][0]) {
dgenies.run.add_error("Target file: " + data["files"][0]["error"], "error");
dgenies.run.enable_form();
}
else {
$("input#target").val(data["files"][0]["name"]);
dgenies.run.hide_loading("target");
dgenies.run.show_success("target");
dgenies.run.upload_next();
}
}
});
......@@ -133,7 +155,18 @@ dgenies.run.disable_form = function () {
};
dgenies.run.enable_form = function () {
$('.progress').find('.bar').css(
'width', '0%'
);
$("input, select, button").prop("disabled", false);
$("div#uploading-loading").hide();
$("button#submit").show();
dgenies.run.hide_loading("query");
dgenies.run.hide_loading("target");
dgenies.run.hide_success("query");
dgenies.run.hide_success("fasta");
dgenies.run.files = [undefined, undefined];
dgenies.run.restore_form();
};
dgenies.run.do_submit = function () {
......
......@@ -2,6 +2,7 @@
import time
import datetime
import shutil
from flask import Flask, render_template, request, url_for, jsonify, session
from lib.paf import Paf
from config_reader import AppConfigReader
......@@ -184,6 +185,7 @@ def upload():
if not allowed_file(files.filename):
result = UploadFile(name=filename, type_f=mime_type, size=0, not_allowed_msg="File type not allowed")
shutil.rmtree(folder_files)
else:
# save file to disk
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment