Respect metadata removal switch
This commit is contained in:
parent
89390b3fc5
commit
e010fe47cc
@ -180,6 +180,7 @@ class Uploader {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
formData.append("removeMetadata", store.state.settings.removeImageMetadata);
|
||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
this.xhr.open("POST", `uploads/new/${token}`);
|
this.xhr.open("POST", `uploads/new/${token}`);
|
||||||
this.xhr.send(formData);
|
this.xhr.send(formData);
|
||||||
|
@ -130,6 +130,7 @@ class Uploader {
|
|||||||
let destDir;
|
let destDir;
|
||||||
let destPath;
|
let destPath;
|
||||||
let streamWriter;
|
let streamWriter;
|
||||||
|
let removeMetadata;
|
||||||
|
|
||||||
const doneCallback = () => {
|
const doneCallback = () => {
|
||||||
// detach the stream and drain any remaining data
|
// detach the stream and drain any remaining data
|
||||||
@ -207,6 +208,11 @@ class Uploader {
|
|||||||
busboyInstance.on("partsLimit", () => abortWithError(Error("Parts limit reached")));
|
busboyInstance.on("partsLimit", () => abortWithError(Error("Parts limit reached")));
|
||||||
busboyInstance.on("filesLimit", () => abortWithError(Error("Files limit reached")));
|
busboyInstance.on("filesLimit", () => abortWithError(Error("Files limit reached")));
|
||||||
busboyInstance.on("fieldsLimit", () => abortWithError(Error("Fields limit reached")));
|
busboyInstance.on("fieldsLimit", () => abortWithError(Error("Fields limit reached")));
|
||||||
|
busboyInstance.on("field", (fieldname, val) => {
|
||||||
|
if (fieldname === "removeMetadata") {
|
||||||
|
removeMetadata = val === "true";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// generate a random output filename for the file
|
// generate a random output filename for the file
|
||||||
// we use do/while loop to prevent the rare case of generating a file name
|
// we use do/while loop to prevent the rare case of generating a file name
|
||||||
@ -260,6 +266,10 @@ class Uploader {
|
|||||||
sequentialRead: true,
|
sequentialRead: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!removeMetadata) {
|
||||||
|
sharpInstance = sharpInstance.withMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
sharpInstance
|
sharpInstance
|
||||||
.rotate() // auto-orient based on the EXIF Orientation tag
|
.rotate() // auto-orient based on the EXIF Orientation tag
|
||||||
.toFile(destPath, (err) => {
|
.toFile(destPath, (err) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user