Image Size Metadata Fix
Problem Description
In early versions of ImageFlow, the image list API returned the file size field as 0B, causing incorrect display on the frontend.What’s Fixed
- Backend fix: updated
listImagesFromRedis
inhandlers/list.go
to read the actual file size from the filesystem. - Standalone migration tool: a dedicated binary under
migrate-tool/
to backfill historical file size metadata in bulk.
How to Use
1. Rebuild the application
2. Build and run the migration tool
3. Restart the ImageFlow service
Legacy Version Fix Guidance
Use this guide if your legacy deployment shows file size as 0B in the image list API, and you need to update historical data after upgrading.-
When to use:
- The
size
/file size shown in the admin UI or the image list API is always 0B. - Historical metadata is missing or hasn’t recorded file size properly.
- The
-
Remediation path:
- Upgrade backend: first deploy the backend version that includes the filesystem-based file size read logic and rebuild.
- Migrate historical data: use the migration tool (see above) to backfill file sizes in bulk.
-
Recommended steps:
- Optional: pause writes (uploads/deletes) during off-peak hours to avoid inconsistencies.
- Upgrade and restart the backend service (see “Rebuild the application” and “Restart the ImageFlow service”).
- Run the migration tool, wait for completion, and review logs for any failures.
- Restart the service again if needed or refresh the admin UI to verify the latest data.
-
Verify the fix:
- Refresh the admin list; sampled images should no longer show 0B.
- Compare displayed size with the filesystem (e.g.,
ls -lh
).
-
Notes:
- Make backups before migration (Redis/metadata store and image directories).
- Ensure the migration tool uses the same environment/configuration (
.env
,LOCAL_STORAGE_PATH
, or storage credentials) and run it in the same environment/container. - For containerized deployments, mount the same volumes and ensure proper network access.
-
Troubleshooting:
- Still 0B after migration: ensure the backend includes the fix and clear frontend caches, then retry.
- File not found/path mismatch: verify
LOCAL_STORAGE_PATH
or storage config matches production. - Migration tool cannot reach cache/metadata store: double-check endpoints, credentials, and network reachability.