[issue-17531] - Deleted original presentation when it is not already a pdf or an image

This commit is contained in:
GuiLeme 2023-05-02 16:26:35 -03:00
parent f03c01399f
commit 54242ec176
2 changed files with 13 additions and 0 deletions

View File

@ -192,4 +192,14 @@ public final class UploadedPresentation {
String nameWithoutExtension = FilenameUtils.removeExtension(name);
this.presentationConvertedName = nameWithoutExtension.concat(".pdf");;
}
public void deleteOriginalFile() {
String pathToFileWithoutExtension = FilenameUtils.removeExtension(uploadedFile.getPath());
String newExtension = FilenameUtils.getExtension(uploadedFile.getPath());
String originalExtension = FilenameUtils.getExtension(name);
if (!originalExtension.equals("pdf") && newExtension.equals("pdf")) {
File originalFile = new File(pathToFileWithoutExtension + "." + originalExtension);
originalFile.delete();
}
}
}

View File

@ -27,6 +27,7 @@ import org.bigbluebutton.presentation.messages.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Arrays;
import java.util.List;
@ -111,6 +112,8 @@ public class SlidesGenerationProgressNotifier {
log.error("GeneratedSlidesInfoHelper was not set. Could not notify interested listeners.");
return;
}
// Completed conversion -> delete original file
pres.deleteOriginalFile();
DocPageCompletedProgress progress = new DocPageCompletedProgress(pres.getPodId(), pres.getMeetingId(),
pres.getId(), pres.getTemporaryPresentationId(), pres.getId(),