Update ZIP exports to use username for filename and internal folders

This commit is contained in:
Atharv1705
2026-09-30 17:33:08 +05:30
parent 268c3d402b
commit 085cbd21b9
2 changed files with 16 additions and 5 deletions
+4 -1
View File
@@ -335,7 +335,10 @@ export default function AdminUserDetail() {
const downloadUrl = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = `user_${userId}_documents.zip`;
const safeName = (userDetail?.name || userDetail?.email?.split('@')[0] || `user_${userId}`).replace(/[^a-zA-Z0-9_\- ]/g, '_').trim();
a.download = `${safeName}_documents_${taxYear ? taxYear : 'all'}.zip`;
document.body.appendChild(a);
a.click();
a.remove();