This approach may introduce inefficiencies, especially if the same cleanup operation is repeated. Additionally, using temporary file names without unique identifiers could lead to file name conflicts if multiple users upload files with the same name concurrently.
📝 Proposal
Implement a UUID-based naming system for all temporary files and directories. This ensures each user's file is uniquely identified, preventing conflicts.
Perform file cleanup only once, after all operations (e.g., unzip, S3 upload) are completed successfully or after any failure.
🔍 Discussion Points
UUID Naming: Should we use a UUID library, or is there a simpler approach?
Centralized Cleanup: Should cleanup be part of a finally block or managed by a dedicated function?
✍ Tasks (If Accepted)
Replace direct use of file.filename with a UUID-based file name.
Consolidate cleanup logic to ensure files and directories are deleted only once, at the end of processing.
Test the solution with concurrent file uploads to verify no conflicts occur.
🎯 Acceptance Criteria
Files are uniquely named using UUIDs, preventing conflicts.
Cleanup occurs only once, ensuring no leftover files or directories.
File handling logic is optimized for clarity and maintainability.
💡 Description
The current implementation deletes files twice:
unzip
.This approach may introduce inefficiencies, especially if the same cleanup operation is repeated. Additionally, using temporary file names without unique identifiers could lead to file name conflicts if multiple users upload files with the same name concurrently.
📝 Proposal
unzip
, S3 upload) are completed successfully or after any failure.🔍 Discussion Points
✍ Tasks (If Accepted)
file.filename
with a UUID-based file name.🎯 Acceptance Criteria