Implemented own blob to buffer function, fixed permission bug by creating copy of map file

This commit is contained in:
Mitchell McCaffrey
2020-04-30 14:24:03 +10:00
parent 58bee3085d
commit d066b262fa
5 changed files with 24 additions and 16 deletions

View File

@@ -11,6 +11,7 @@ import MapSettings from "../components/map/MapSettings";
import AuthContext from "../contexts/AuthContext";
import usePrevious from "../helpers/usePrevious";
import blobToBuffer from "../helpers/blobToBuffer";
import { maps as defaultMaps } from "../maps";
@@ -140,11 +141,14 @@ function SelectMapModal({
}
let image = new Image();
setImageLoading(true);
// Copy file to avoid permissions issues
const copy = new Blob([file], { type: file.type });
// Create and load the image temporarily to get its dimensions
const url = URL.createObjectURL(file);
const url = URL.createObjectURL(copy);
image.onload = function () {
handleMapAdd({
file,
file: copy,
name,
type: "file",
gridX: fileGridX,