fix: Update Google Drive file upload to use authorization headers

This commit is contained in:
Taylor Wilsdon (aider) 2024-12-15 18:52:24 -05:00
parent 4adcd2b64a
commit 7dace30587
2 changed files with 7 additions and 5 deletions

View File

@ -356,12 +356,13 @@
collection_name: '',
status: 'uploading',
url: fileData.url,
headers: fileData.headers,
error: ''
};
try {
files = [...files, fileItem];
const res = await processWeb(localStorage.token, '', fileData.url);
const res = await processWeb(localStorage.token, '', fileData.url, fileData.headers);
if (res) {
fileItem.status = 'uploaded';

View File

@ -119,14 +119,15 @@ export const createPicker = () => {
url: fileUrl
});
// Get the downloadUrl using the alt=media parameter
// Construct download URL with access token
const downloadUrl = `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media&access_token=${oauthToken}`;
// Construct download URL without embedding token
const downloadUrl = `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media`;
const result = {
id: fileId,
name: fileName,
url: downloadUrl,
token: oauthToken // Include token for future use
headers: {
'Authorization': `Bearer ${oauthToken}`
}
};
console.log('Resolving picker with:', result);
resolve(result);