Description:
During down-sync operations in several modules, the local Room database is cleared (clearAll()) and repopulated with server data. However, the Base64 images attached to these payloads are saved to physical storage using System.currentTimeMillis() in the filename.
Because the old files are never deleted and the new files get entirely unique timestamped names, every sync creates a full duplicate set of images on the user's disk. For field workers syncing daily, this results in rapid storage bloat, eventually leading to IOException: No space left on device.
Affected Files:
SaasBahuSammelanRepo.kt
UwinRepo.kt
MaaMeetingRepo.kt
Expected Behavior:
The app should maintain a stable storage footprint regardless of how many times a user syncs.
Suggested Fix:
Refactor the file creation logic to use deterministic naming based on the entity ID and image index (e.g., "saas_bahu_${item.id}_img${index}.$ext"). This guarantees that subsequent syncs safely overwrite the existing cache files instead of infinitely accumulating orphaned duplicates.
Description:
During down-sync operations in several modules, the local Room database is cleared (
clearAll()) and repopulated with server data. However, the Base64 images attached to these payloads are saved to physical storage usingSystem.currentTimeMillis()in the filename.Because the old files are never deleted and the new files get entirely unique timestamped names, every sync creates a full duplicate set of images on the user's disk. For field workers syncing daily, this results in rapid storage bloat, eventually leading to
IOException: No space left on device.Affected Files:
SaasBahuSammelanRepo.ktUwinRepo.ktMaaMeetingRepo.ktExpected Behavior:
The app should maintain a stable storage footprint regardless of how many times a user syncs.
Suggested Fix:
Refactor the file creation logic to use deterministic naming based on the entity ID and image index (e.g.,
"saas_bahu_${item.id}_img${index}.$ext"). This guarantees that subsequent syncs safely overwrite the existing cache files instead of infinitely accumulating orphaned duplicates.