fix: Move and Copy file conflict check race condition
parent
b28952cb25
commit
e35c7737c2
|
@ -80,7 +80,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),
|
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),
|
||||||
copy: async function (event) {
|
copy: function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const items = [];
|
const items = [];
|
||||||
|
|
||||||
|
@ -122,29 +122,29 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dstItems = (await api.fetch(this.dest)).items;
|
|
||||||
const conflict = upload.checkConflict(items, dstItems);
|
|
||||||
|
|
||||||
let overwrite = false;
|
let overwrite = false;
|
||||||
let rename = false;
|
let rename = false;
|
||||||
|
|
||||||
if (conflict) {
|
api.fetch(this.dest).then((dst) => {
|
||||||
this.showHover({
|
const conflict = upload.checkConflict(items, dst.items);
|
||||||
prompt: "replace-rename",
|
if (conflict) {
|
||||||
confirm: (event, option) => {
|
this.showHover({
|
||||||
overwrite = option == "overwrite";
|
prompt: "replace-rename",
|
||||||
rename = option == "rename";
|
confirm: (event, option) => {
|
||||||
|
overwrite = option == "overwrite";
|
||||||
|
rename = option == "rename";
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.closeHovers();
|
this.closeHovers();
|
||||||
action(overwrite, rename);
|
action(overwrite, rename);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
action(overwrite, rename);
|
action(overwrite, rename);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -85,7 +85,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),
|
...mapActions(useLayoutStore, ["showHover", "closeHovers"]),
|
||||||
move: async function (event) {
|
move: function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const items = [];
|
const items = [];
|
||||||
|
|
||||||
|
@ -112,29 +112,29 @@ export default {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const dstItems = (await api.fetch(this.dest)).items;
|
|
||||||
const conflict = upload.checkConflict(items, dstItems);
|
|
||||||
|
|
||||||
let overwrite = false;
|
let overwrite = false;
|
||||||
let rename = false;
|
let rename = false;
|
||||||
|
|
||||||
if (conflict) {
|
api.fetch(this.dest).then((dst) => {
|
||||||
this.showHover({
|
const conflict = upload.checkConflict(items, dst.items);
|
||||||
prompt: "replace-rename",
|
if (conflict) {
|
||||||
confirm: (event, option) => {
|
this.showHover({
|
||||||
overwrite = option == "overwrite";
|
prompt: "replace-rename",
|
||||||
rename = option == "rename";
|
confirm: (event, option) => {
|
||||||
|
overwrite = option == "overwrite";
|
||||||
|
rename = option == "rename";
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.closeHovers();
|
this.closeHovers();
|
||||||
action(overwrite, rename);
|
action(overwrite, rename);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
action(overwrite, rename);
|
action(overwrite, rename);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue