diff --git a/src/main/java/org/olat/core/commons/modules/bc/commands/CmdUnzip.java b/src/main/java/org/olat/core/commons/modules/bc/commands/CmdUnzip.java index 39b11f54c23a37f1b1bef033d93213ca6eac3dbf..e23c0469606dc9a7dd2f85a11eb6ea1c44f67efb 100644 --- a/src/main/java/org/olat/core/commons/modules/bc/commands/CmdUnzip.java +++ b/src/main/java/org/olat/core/commons/modules/bc/commands/CmdUnzip.java @@ -95,23 +95,30 @@ public class CmdUnzip extends BasicController implements FolderCommand { return null; } - boolean fileNotExist = false; - for (String sItem:selection.getFiles()) { - VFSItem vfsItem = currentContainer.resolve(sItem); - if (vfsItem != null && (vfsItem instanceof VFSLeaf)) { - if (!doUnzip((VFSLeaf)vfsItem, currentContainer, ureq, wContr)) { - status = FolderCommandStatus.STATUS_FAILED; + VFSItem currentVfsItem = null; + try { + boolean fileNotExist = false; + for (String sItem:selection.getFiles()) { + currentVfsItem = currentContainer.resolve(sItem); + if (currentVfsItem != null && (currentVfsItem instanceof VFSLeaf)) { + if (!doUnzip((VFSLeaf)currentVfsItem, currentContainer, ureq, wContr)) { + status = FolderCommandStatus.STATUS_FAILED; + break; + } + } else { + fileNotExist = true; break; } - } else { - fileNotExist = true; - break; } - } - - if (fileNotExist) { - status = FolderCommandStatus.STATUS_FAILED; - getWindowControl().setError(translator.translate("FileDoesNotExist")); + + if (fileNotExist) { + status = FolderCommandStatus.STATUS_FAILED; + getWindowControl().setError(translator.translate("FileDoesNotExist")); + } + } catch (IllegalArgumentException e) { + logError("Corrupted ZIP", e); + String name = currentVfsItem == null ? "NULL" : currentVfsItem.getName(); + getWindowControl().setError(translator.translate("FileUnzipFailed", new String[]{name})); } return null;