Pick up files added to the Blog folder in Drive, and name nginx errors
Opening Tools → Media → Files (or a Choose a file picker) now looks in the shared drive's Blog folder, at most every 30 seconds, and adds anything put there in Drive itself: shared as anyone with the link, previewed, Google Docs, Sheets and Slides included, folders and shortcuts left out. A file Drive won't share is named in a note and tried again every ten minutes. A reply that isn't the API's (nginx's own error page) now says what it was: a 413 names nginx's upload limit, a 502 the service, a 504 the timeout, instead of "Server did not return JSON". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5f13273e69
commit
6191322fea
6 changed files with 143 additions and 25 deletions
|
|
@ -187,6 +187,31 @@ export async function driveUpload(folder, name, mime, buffer) {
|
|||
return await res.json();
|
||||
}
|
||||
|
||||
/* The files (not folders) directly in a folder of the shared drive:
|
||||
[{ id, name, mimeType, size, webViewLink }]. size is missing for
|
||||
Google's own Docs, Sheets and Slides. */
|
||||
export async function driveList(folder) {
|
||||
const parent = await driveFolder(folder);
|
||||
const found = [];
|
||||
let pageToken = "";
|
||||
do {
|
||||
const query = new URLSearchParams({
|
||||
q: `'${parent}' in parents and trashed = false and mimeType != '${FOLDER}'`,
|
||||
corpora: "drive",
|
||||
driveId: process.env.GOOGLE_SHARED_DRIVE,
|
||||
includeItemsFromAllDrives: "true",
|
||||
supportsAllDrives: "true",
|
||||
pageSize: "200",
|
||||
fields: "nextPageToken,files(id,name,mimeType,size,webViewLink)",
|
||||
...(pageToken ? { pageToken } : {}),
|
||||
});
|
||||
const page = await (await call(`${DRIVE}?${query}`, {}, DRIVE_SCOPE)).json();
|
||||
found.push(...(page.files ?? []));
|
||||
pageToken = page.nextPageToken ?? "";
|
||||
} while (pageToken);
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Anyone with the link can view: for files the public site links to.
|
||||
Refused when the shared drive (or the Workspace) doesn't allow
|
||||
sharing outside the organization. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue