Fix duplication of video and webpage slides

This commit is contained in:
Timo Wagner committed 2025-11-08 22:21:03 +01:00
1 parent 1fef8a85af
commit f19c6e3d88
1 file changed
+20 -22
+20 -22
View File
@@ -48,29 +48,27 @@ export default class bundleClass {
duplicateUuid(uuid) {
for (let slide of this.allSlides) {
if (slide.uuid === uuid) {
if (slide.type === "slide") {
let newId = uuidv4();
let path = process.cwd() + "/data/bundles/" + this.name;
try {
uuid = checkAndSanitizeFilePathName(uuid)
// duplicate at filesystem
if (fs.existsSync(path + "/render/" + uuid + ".png")) {
fs.copyFileSync(path + "/render/" + uuid + ".png", path + "/render/" + newId + ".png");
}
if (fs.existsSync(path + "/slides/" + uuid)) {
fs.copyFileSync(path + "/slides/" + uuid, path + "/slides/" + newId);
}
// duplicate at json
let newSlide = clone(slide);
newSlide.uuid = newId;
this.allSlides.push(newSlide);
this.save();
return;
} catch (err) {
cli.error("error while duplicating file:" + uuid, err);
return;
let newId = uuidv4();
let path = process.cwd() + "/data/bundles/" + this.name;
try {
uuid = checkAndSanitizeFilePathName(uuid)
// duplicate at filesystem
if (fs.existsSync(path + "/render/" + uuid + ".png")) {
fs.copyFileSync(path + "/render/" + uuid + ".png", path + "/render/" + newId + ".png");
}
if (fs.existsSync(path + "/slides/" + uuid)) {
fs.copyFileSync(path + "/slides/" + uuid, path + "/slides/" + newId);
}
// duplicate at json
let newSlide = clone(slide);
newSlide.uuid = newId;
this.allSlides.push(newSlide);
this.save();
return;
} catch (err) {
cli.error("error while duplicating file:" + uuid, err);
return;
}
}
}