Merge pull request #77 from kasimos/fixDuplicateMaster

Fix duplication of video and webpage slides
This commit is contained in:
Petri Järvisalo authored and GitHub committed 2025-11-10 07:51:07 +02:00
commit 6f867cad06
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;
}
}
}