Skip to content

Commit

Permalink
CodeQL issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fugerit79 committed Aug 29, 2024
1 parent cbd51d5 commit 3cd5e76
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public static void checkIfInTempFolder( File file ) throws IOException {
}
}
public static void zipFolder(File sourceFolder, OutputStream fos) throws IOException {
checkIfInTempFolder( sourceFolder ); // security check
ZipOutputStream zos = new ZipOutputStream(fos);
// Ensure the source folder exists
if (!sourceFolder.exists()) {
Expand All @@ -120,6 +121,7 @@ public static void zipFolder(File sourceFolder, OutputStream fos) throws IOExcep
fos.close();
}
private static void zipFile(File fileToZip, String fileName, ZipOutputStream zos) throws IOException {
checkIfInTempFolder( fileToZip ); // security check
if (fileToZip.isDirectory()) {
zos.putNextEntry(new ZipEntry( ensureEndWithSlash( fileName ) ));
zos.closeEntry();
Expand Down

0 comments on commit 3cd5e76

Please sign in to comment.