feat: Add local file download for debugging Google Drive file upload

This commit is contained in:
Taylor Wilsdon (aider) 2024-12-15 19:52:39 -05:00
parent f4f8334153
commit 42af98ae28

View File

@ -394,6 +394,16 @@
const fileBlob = await fileResponse.blob(); const fileBlob = await fileResponse.blob();
const file = new File([fileBlob], fileData.name, { type: fileBlob.type }); const file = new File([fileBlob], fileData.name, { type: fileBlob.type });
// Create a download link for debugging
const downloadUrl = URL.createObjectURL(fileBlob);
const downloadLink = document.createElement('a');
downloadLink.href = downloadUrl;
downloadLink.download = fileData.name;
document.body.appendChild(downloadLink);
downloadLink.click();
document.body.removeChild(downloadLink);
URL.revokeObjectURL(downloadUrl);
console.log('File fetched successfully, uploading to server...'); console.log('File fetched successfully, uploading to server...');
const uploadedFile = await uploadFile(localStorage.token, file); const uploadedFile = await uploadFile(localStorage.token, file);