File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed
wp1-frontend/src/components Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 8686 v-else-if =" item.z_url && !hasDeletedZim(item)"
8787 :class =" { 'outdated-zim': hasOutdatedZim(item) }"
8888 >
89- <a : href =" item.z_url " >Download ZIM</a >
89+ <a href =" # " @click.prevent = " downloadZim(item) " >Download ZIM</a >
9090 <span
9191 v-if =" hasOutdatedZim(item)"
9292 data-toggle =" tooltip"
@@ -269,6 +269,17 @@ export default {
269269 localDate: function (date) {
270270 return localDate(date);
271271 },
272+ downloadZim: async function (item) {
273+ const response = await fetch(item.z_url);
274+ if (response.status === 410) {
275+ this.$router.push({
276+ path: ` /selections/${item .id }/zim` ,
277+ query: { expired: true },
278+ });
279+ } else {
280+ window.location.href = item.z_url;
281+ }
282+ },
272283 },
273284 created: function () {
274285 this.getLists();
Original file line number Diff line number Diff line change 8383 page and the My Selections page will automatically update with a URL
8484 to download your ZIM file once it is ready.
8585 </p >
86- <p v-if =" isDeleted && status == 'FILE_READY'" class =" errors" >
86+ <p
87+ v-if =" forceExpiredDisplay || (isDeleted && status == 'FILE_READY')"
88+ class =" errors"
89+ >
8790 Your ZIM file has expired and needs to be re-created. ZIM file
8891 download links are only valid for 2 weeks. You can re-create your
8992 ZIM file with the button below.
108111 <div
109112 v-if ="
110113 !activeSchedule &&
111- (status === 'NOT_REQUESTED' ||
114+ (forceExpiredDisplay ||
115+ status === 'NOT_REQUESTED' ||
112116 status === 'FAILED' ||
113117 (status != 'REQUESTED' && isDeleted))
114118 "
294298 </div >
295299 </div >
296300 <div
297- v-else-if =" status === 'FILE_READY' || status === 'REQUESTED'"
301+ v-else-if ="
302+ !forceExpiredDisplay &&
303+ (status === 'FILE_READY' || status === 'REQUESTED')
304+ "
298305 class =" row"
299306 >
300307 <div class =" col-lg-6 col-md-9 mx-4" >
@@ -364,11 +371,15 @@ export default {
364371 repetitionPeriodInMonths: 1 ,
365372 numberOfRepetitions: 1 ,
366373 scheduleEmail: ' ' ,
374+ forceExpiredDisplay: false ,
367375 };
368376 },
369377 created : async function () {
370378 await this .getBuilder ();
371379 await this .getStatus ();
380+ if (this .$route .query .expired ) {
381+ this .forceExpiredDisplay = true ;
382+ }
372383 await this .loadUserEmail ();
373384 this .ready = true ;
374385 },
Original file line number Diff line number Diff line change @@ -356,6 +356,10 @@ def latest_zim_file_for_builder(builder_id):
356356 if not url :
357357 flask .abort (404 )
358358
359+ head = requests .head (url )
360+ if head .status_code == 404 :
361+ flask .abort (410 )
362+
359363 return flask .redirect (url , code = 302 )
360364
361365
You can’t perform that action at this time.
0 commit comments