mitre / heimdall-vue

(deprecated) A refactor of the heimdall-lite project using vue, see:
https://github.com/mitre/heimdall-vuetify
Other
8 stars 3 forks source link

Failed file uploads redirect to a results view with no data #99

Open lukemalinowski opened 5 years ago

lukemalinowski commented 5 years ago

FileReader component transfers control to results view even if upload fails.

Fix is to either get FileReader to stop transferring control if upload fails. Since the upload is asynchronous this may be difficult, but we could just wait till the file finishes uploading before transferring control to another view, await, but it is uncertain whether the dispatcher returns the FileReader promise or anything useful.

---- src/components/FileReader.vue ----

    loadTextFromFile(ev) {
      let file = ev.target.files[0];
      let unique_id = this.$store.getters["data/nextFreeFileID"];
// See next 2 lines
      this.$store.dispatch("intake/loadFile", {file, unique_id});
      this.$router.push("/results/" + unique_id)
    }

Other option is to get the results view to pop the current route if it detects no profile exists at the current url id. But you'll have to verify that there is no file being uploaded, or have a timeout.