mirror of
https://github.com/open-webui/open-webui
synced 2025-05-14 18:46:02 +00:00
fix: Update Google Drive file upload to use authorization headers
This commit is contained in:
parent
4adcd2b64a
commit
7dace30587
@ -356,12 +356,13 @@
|
|||||||
collection_name: '',
|
collection_name: '',
|
||||||
status: 'uploading',
|
status: 'uploading',
|
||||||
url: fileData.url,
|
url: fileData.url,
|
||||||
|
headers: fileData.headers,
|
||||||
error: ''
|
error: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
files = [...files, fileItem];
|
files = [...files, fileItem];
|
||||||
const res = await processWeb(localStorage.token, '', fileData.url);
|
const res = await processWeb(localStorage.token, '', fileData.url, fileData.headers);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
fileItem.status = 'uploaded';
|
fileItem.status = 'uploaded';
|
||||||
|
@ -119,14 +119,15 @@ export const createPicker = () => {
|
|||||||
url: fileUrl
|
url: fileUrl
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get the downloadUrl using the alt=media parameter
|
// Construct download URL without embedding token
|
||||||
// Construct download URL with access token
|
const downloadUrl = `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media`;
|
||||||
const downloadUrl = `https://www.googleapis.com/drive/v3/files/${fileId}?alt=media&access_token=${oauthToken}`;
|
|
||||||
const result = {
|
const result = {
|
||||||
id: fileId,
|
id: fileId,
|
||||||
name: fileName,
|
name: fileName,
|
||||||
url: downloadUrl,
|
url: downloadUrl,
|
||||||
token: oauthToken // Include token for future use
|
headers: {
|
||||||
|
'Authorization': `Bearer ${oauthToken}`
|
||||||
|
}
|
||||||
};
|
};
|
||||||
console.log('Resolving picker with:', result);
|
console.log('Resolving picker with:', result);
|
||||||
resolve(result);
|
resolve(result);
|
||||||
|
Loading…
Reference in New Issue
Block a user