Skip to content

Commit

Permalink
chore: add mime type instead of file extension when uploading file
Browse files Browse the repository at this point in the history
(cherry picked from commit ba98dad)
  • Loading branch information
omar authored and SebastianOpriel committed Aug 3, 2022
1 parent 3df75ba commit 421eba1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AddBackendConnectionDialog from "@/pages/backendconnections/dialog/AddBac
import dataUtils from "@/utils/dataUtils";
import errorUtils from "@/utils/errorUtils";
import validationUtils from "../../../../../utils/validationUtils";
import mime from 'mime';

export default {
components: {
Expand Down Expand Up @@ -134,7 +135,9 @@ export default {
};
}
if (file.name.lastIndexOf(".") != -1) {
this.$data.filetype = file.name.substring(file.name.lastIndexOf(".") + 1, file.name.length);
let extension = file.name.substring(file.name.lastIndexOf(".") + 1, file.name.length);
//file type is actually mime type
this.$data.filetype = mime.getType(extension)
} else {
this.$data.filetype = "";
}
Expand Down

0 comments on commit 421eba1

Please sign in to comment.