Fix: Handle expired ZIM files by checking Wasabi storage (Closes #819) #833
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the handling of expired ZIM files by pre-fetching the Wasabi storage URL before showing the expiration message. Instead of relying only on the timestamp, we now make a HEAD request to check if the file is still available. If the request returns a 404 Not Found, we redirect the user to a frontend page explaining that the ZIM file has expired and providing a button to re-request it.
Changes Made:
Motivation:
Previously, users could miss the expiration message because it was based only on timestamps. This change ensures that users are clearly informed when a ZIM file is no longer available.
How It Works:
Before displaying the expired message, the system now sends a HEAD request to Wasabi storage.
If the file exists, everything continues as usual.
If the response is 404 (Not Found), the user is redirected to a page that explains the expiration and provides a "Re-request ZIM" button.
Testing:
Notes:
I'm a beginner in open-source and trying to contribute to good projects. I'm excited to learn and grow, and I hope to find great mentors to support my journey. Feedback is welcome!