diff --git a/src/main/java/com/dostalgia/UploadResource.java b/src/main/java/com/dostalgia/UploadResource.java index 7caae84..a7876a8 100644 --- a/src/main/java/com/dostalgia/UploadResource.java +++ b/src/main/java/com/dostalgia/UploadResource.java @@ -64,7 +64,12 @@ public class UploadResource { Path extractDir = tmpDir.resolve("extracted"); unzip(zipPath, extractDir); // If the ZIP has a single root directory, flatten it - flattenSingleDir(extractDir); + try { + flattenSingleDir(extractDir); + } catch (Exception e) { + LOG.warning("Flatten failed for '" + filename + "': " + e.getMessage() + + " — continuing (cd in autoexec handles subdirs)"); + } // Find main executable String mainExe = findMainExe(extractDir); @@ -120,6 +125,11 @@ public class UploadResource { return Response.status(201).entity(game).build(); + } catch (Exception e) { + LOG.severe("Upload failed for '" + filename + "': " + e.getMessage()); + return Response.serverError() + .entity(Map.of("error", "Upload failed: " + e.getMessage())) + .build(); } finally { deleteDir(tmpDir); }