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:
Zaldimmar 2026-09-29 19:14:40 -05:00
parent 5f13273e69
commit 6191322fea
6 changed files with 143 additions and 25 deletions

View file

@ -24,6 +24,7 @@ import {
FILE_HELP,
FileList,
FileUploadButton,
RefusedNote,
useDriveFiles,
} from "../../components/admin/DriveFiles.tsx";
import {
@ -142,7 +143,7 @@ function CopyPath({ url, label = "Copy path" }: { url: string; label?: string })
function FilesTab() {
const { user } = useAuth();
const [query, setQuery] = useState("");
const { items, ready, error, setItems } = useDriveFiles(query);
const { items, ready, refused, error, setItems } = useDriveFiles(query);
return (
<>
@ -167,6 +168,7 @@ function FilesTab() {
</p>
)}
<div className="mt-6">
<RefusedNote names={refused} />
{error ? (
<p className="text-sm text-danger">{error}</p>
) : items === null ? (
@ -217,7 +219,7 @@ export default function AdminMedia() {
<p className="text-sm text-muted">
{tab === "images"
? "Uploaded images. Image fields in every editor pick from here."
: "Files in the shared Google Drive, for pages to link to. Link fields pick from here with Choose a file."}
: "Files in the shared Google Drive's Blog folder, for pages to link to, including any put there in Drive itself. Link fields pick from here with Choose a file."}
</p>
</div>