Summary
mapps manifest:import builds a zip before upload. Today that zip is written as temp.zip in the current working directory, and the import task never deletes it. The task only removes the intermediate *.processed manifest file in finally.
That leaves temp.zip behind after a successful import (and can leave it behind or partially written on failure, depending on when things fail). Using a fixed name in cwd is also awkward for concurrent runs or if temp.zip already exists.
Current behavior
compressFilesToZip in files-service uses a literal temp.zip path (relative to cwd).
uploadManifestTsk in import-manifest-service calls unlink only for ctx.manifestFilePath (the .processed file), not for the zip path.
Expected behavior
- Zip should be created under the OS temp directory with a unique name (e.g.
mapps-compress-<uuid>.zip).
- The zip file should be removed in a
finally block (best-effort if the file is already gone), so cleanup happens on both success and failure after the zip was created.
Suggested fix (reference)
- Change
compressFilesToZip to write under os.tmpdir() with a unique filename.
- In
uploadManifestTsk, track zipFilePath and unlink it in finally (e.g. zip cleanup first with best-effort error handling, then existing .processed cleanup).
Tests
- Unit tests for
uploadManifestTsk that assert unlink is invoked for both the temp zip path and the .processed manifest on success and when upload throws after the zip exists.
Summary
mapps manifest:importbuilds a zip before upload. Today that zip is written astemp.zipin the current working directory, and the import task never deletes it. The task only removes the intermediate*.processedmanifest file infinally.That leaves
temp.zipbehind after a successful import (and can leave it behind or partially written on failure, depending on when things fail). Using a fixed name in cwd is also awkward for concurrent runs or iftemp.zipalready exists.Current behavior
compressFilesToZipinfiles-serviceuses a literaltemp.zippath (relative to cwd).uploadManifestTskinimport-manifest-servicecallsunlinkonly forctx.manifestFilePath(the.processedfile), not for the zip path.Expected behavior
mapps-compress-<uuid>.zip).finallyblock (best-effort if the file is already gone), so cleanup happens on both success and failure after the zip was created.Suggested fix (reference)
compressFilesToZipto write underos.tmpdir()with a unique filename.uploadManifestTsk, trackzipFilePathandunlinkit infinally(e.g. zip cleanup first with best-effort error handling, then existing.processedcleanup).Tests
uploadManifestTskthat assertunlinkis invoked for both the temp zip path and the.processedmanifest on success and when upload throws after the zip exists.