mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-11 05:08:43 -04:00
If import failed, delete file stub(s)
This commit is contained in:
parent
da686212f0
commit
3af9fd1ea3
@ -1353,8 +1353,13 @@ archiveFilesLegacy.addEventListener('change', function (files) {
|
|||||||
console.error('Unable to import files to OPFS!', err);
|
console.error('Unable to import files to OPFS!', err);
|
||||||
var message = '<p>We could not import the selected files to the OPFS!</p><p>Reason: ' + err.message + '</p>';
|
var message = '<p>We could not import the selected files to the OPFS!</p><p>Reason: ' + err.message + '</p>';
|
||||||
if (/iOS/.test(params.appType) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) message = '<p>Unfortunately, Safari and iOS browsers do not currently support importing files into the OPFS. Please disable the OPFS and use other file selection options.</p><p>Error message: ' + err.message + '</p>';
|
if (/iOS/.test(params.appType) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) message = '<p>Unfortunately, Safari and iOS browsers do not currently support importing files into the OPFS. Please disable the OPFS and use other file selection options.</p><p>Error message: ' + err.message + '</p>';
|
||||||
uiUtil.systemAlert(message, 'OPFS import error');
|
|
||||||
uiUtil.pollOpsPanel();
|
uiUtil.pollOpsPanel();
|
||||||
|
uiUtil.systemAlert(message, 'OPFS import error').then(function () {
|
||||||
|
// Delete each of the files that failed to import
|
||||||
|
filesArray.forEach(function (file) {
|
||||||
|
cache.deleteOPFSEntry(file.name);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -629,7 +629,9 @@ function requestXhttpData (URL, lang, subj, kiwixDate) {
|
|||||||
percentageComplete = 0;
|
percentageComplete = 0;
|
||||||
var message = 'Unable to download the archive ' + archiveName + ' to your device: ' + err;
|
var message = 'Unable to download the archive ' + archiveName + ' to your device: ' + err;
|
||||||
if (/iOS/.test(params.appType) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) message = '<p>Unfortunately, Safari and iOS browsers do not currently support downloading files directly into the OPFS. Please select a different download method.</p><p>Error message: ' + err.message + '</p>';
|
if (/iOS/.test(params.appType) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) message = '<p>Unfortunately, Safari and iOS browsers do not currently support downloading files directly into the OPFS. Please select a different download method.</p><p>Error message: ' + err.message + '</p>';
|
||||||
return uiUtil.systemAlert(message, 'Download failed');
|
return uiUtil.systemAlert(message, 'Download failed').then(function () {
|
||||||
|
return cache.deleteOPFSEntry(archiveName);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (megabytes > 1000) {
|
if (megabytes > 1000) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user