Fix SSE, KMS not encrypting files
This commit is contained in:
@@ -2850,18 +2850,51 @@
|
||||
if (!presignLink?.value) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await navigator.clipboard.writeText(presignLink.value);
|
||||
|
||||
// Helper function for fallback copy
|
||||
const fallbackCopy = (text) => {
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.left = '-999999px';
|
||||
textArea.style.top = '-999999px';
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
let success = false;
|
||||
try {
|
||||
success = document.execCommand('copy');
|
||||
} catch (err) {
|
||||
success = false;
|
||||
}
|
||||
textArea.remove();
|
||||
return success;
|
||||
};
|
||||
|
||||
let copied = false;
|
||||
|
||||
// Try modern clipboard API first
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(presignLink.value);
|
||||
copied = true;
|
||||
} catch (error) {
|
||||
// Fall through to fallback
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback for non-secure contexts
|
||||
if (!copied) {
|
||||
copied = fallbackCopy(presignLink.value);
|
||||
}
|
||||
|
||||
if (copied) {
|
||||
copyPresignLink.textContent = 'Copied!';
|
||||
window.setTimeout(() => {
|
||||
copyPresignLink.textContent = copyPresignDefaultLabel;
|
||||
}, 1500);
|
||||
} catch (error) {
|
||||
if (window.showToast) {
|
||||
window.showToast('Unable to copy link to clipboard.', 'Copy failed', 'warning');
|
||||
} else {
|
||||
alert('Unable to copy link to clipboard.');
|
||||
}
|
||||
} else {
|
||||
showMessage({ title: 'Copy Failed', body: 'Unable to copy link to clipboard. Please select the link and copy manually.', variant: 'warning' });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3229,11 +3262,7 @@
|
||||
window.URL.revokeObjectURL(url);
|
||||
a.remove();
|
||||
} catch (error) {
|
||||
if (window.showToast) {
|
||||
window.showToast(error.message, 'Download Failed', 'error');
|
||||
} else {
|
||||
alert(error.message);
|
||||
}
|
||||
showMessage({ title: 'Download Failed', body: error.message, variant: 'danger' });
|
||||
} finally {
|
||||
bulkDownloadButton.disabled = false;
|
||||
bulkDownloadButton.innerHTML = originalHtml;
|
||||
|
||||
@@ -688,7 +688,9 @@
|
||||
rotateDoneBtn.classList.remove('d-none');
|
||||
|
||||
} catch (err) {
|
||||
alert(err.message);
|
||||
if (window.showToast) {
|
||||
window.showToast(err.message, 'Error', 'danger');
|
||||
}
|
||||
rotateSecretModal.hide();
|
||||
} finally {
|
||||
confirmRotateBtn.disabled = false;
|
||||
|
||||
Reference in New Issue
Block a user