Fix: allow selecting .tar.gz archives in macOS Finder by broadening input accept attribute and adding client-side validation
This commit is contained in:
1 parent
8b57981b1b
commit
a09f13de71
2 files changed
+8
-1
No files matched your search
@@ -4584,6 +4584,13 @@ async function handleBackupUpload(input) {
|
|||||||
const file = input?.files?.[0];
|
const file = input?.files?.[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
|
const lowerName = file.name.toLowerCase();
|
||||||
|
if (!lowerName.endsWith('.tar.gz') && !lowerName.endsWith('.tgz')) {
|
||||||
|
showToast("Format de fichier non supporté. Veuillez sélectionner une archive de sauvegarde .tar.gz ou .tgz", 'error');
|
||||||
|
input.value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const ok = confirm(`⚠️ RESTAURATION DISASTER RECOVERY VIA FICHIER TÉLÉVERSÉ ⚠️\n\nFichier sélectionné : ${file.name} (${(file.size / (1024 * 1024)).toFixed(2)} Mo)\n\nVoulez-vous restaurer immédiatement le système NexusPBX avec cette archive ?\nToutes les données actuelles seront remplacées.`);
|
const ok = confirm(`⚠️ RESTAURATION DISASTER RECOVERY VIA FICHIER TÉLÉVERSÉ ⚠️\n\nFichier sélectionné : ${file.name} (${(file.size / (1024 * 1024)).toFixed(2)} Mo)\n\nVoulez-vous restaurer immédiatement le système NexusPBX avec cette archive ?\nToutes les données actuelles seront remplacées.`);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
input.value = '';
|
input.value = '';
|
||||||
|
|||||||
+1
-1
@@ -1533,7 +1533,7 @@ $currentUser = Auth::getUsername();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2.5 flex-wrap">
|
<div class="flex items-center gap-2.5 flex-wrap">
|
||||||
<input type="file" id="backup-upload-input" accept=".tar.gz,.tgz" class="hidden" onchange="handleBackupUpload(this)">
|
<input type="file" id="backup-upload-input" accept=".tar.gz,.tgz,.gz,.tar,application/gzip,application/x-gzip,application/x-tar,application/x-compressed-tar,application/octet-stream" class="hidden" onchange="handleBackupUpload(this)">
|
||||||
<button type="button" onclick="triggerBackupUpload()"
|
<button type="button" onclick="triggerBackupUpload()"
|
||||||
class="inline-flex items-center gap-2 px-3.5 py-2.5 rounded-xl bg-anthracite-900 hover:bg-anthracite-750 border border-anthracite-600 text-xs font-semibold text-slate-200 hover:text-white transition shadow-sm">
|
class="inline-flex items-center gap-2 px-3.5 py-2.5 rounded-xl bg-anthracite-900 hover:bg-anthracite-750 border border-anthracite-600 text-xs font-semibold text-slate-200 hover:text-white transition shadow-sm">
|
||||||
<svg class="w-4 h-4 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
<svg class="w-4 h-4 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
|||||||
Reference in new issue
Block a user