Skip to content

Fix: let the config export report a failure - #41

Merged
SandObserver merged 1 commit into
mainfrom
fix/export-reports-failures
Aug 12, 2026
Merged

SandObserver merged 1 commit into
mainfrom
fix/export-reports-failures

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Fetch /api/config/export through ag and save a blob built from the response, instead of assigning the endpoint to an anchor's href and clicking it.
  • A refusal, server error or expired session is now reported through the existing toast.exportFailed, which nothing could previously reach; an expired session raises the sign-in box and the export completes afterwards.
  • Revoke the object URL on the next frame, so the blob is not held for the lifetime of the page.
  • Drop the now-unused API import from admin.js.

Testing
All green. Added 5 tests pinning the handler to the fetch route, the failure report, the object-URL release, and the existing download filename.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

The export set an anchor's href to the endpoint and clicked it, which hands the
request to the browser. The page never learned the outcome, so the try/catch
around the click could not observe one: a refusal, a server error or an expired
session was written to disk as an error body under the backup's own filename.
The failure surfaced when the backup was needed.

Fetch it through ag instead, check the response, and save a blob built from it.
An expired session now raises the sign-in box and the export finishes
afterwards, since that is what every other admin request already does.

The catalog already carried toast.exportFailed, which nothing could reach.
@SandObserver SandObserver added the bug Something isn't working label Aug 12, 2026
@SandObserver
SandObserver merged commit e35818a into main Aug 12, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/export-reports-failures branch August 12, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant