Skip to content

fix(frontend): skip crawl-job lookup for non-crawl documents

Jérôme Revillard requested to merge fix/doc-crawl-job-404 into main

Problem

Clicking a regular uploaded document in the web document library logged a 404 and showed a user-facing error toast:

Failed to load resource: the server responded with a status of 404 (Not Found)
httpService.js:225 API response error
documentFileService.js:200 Error fetching crawl job for file <id>

Root cause

FileDetailsDialog.fetchData() called documentFileService.getCrawlJob(id) unconditionally for every file. Regular uploads have no crawl_job row, so the backend returns 404 { error: "Crawl job not found" }. That 404 flows through httpService's global response-error interceptor, which fires notificationService.error(...) for every non-401 error — the visible toast — plus console noise. fetchData's own try/catch silently swallowed the rejection, but only after the toast had already fired.

The Flutter mobile app is unaffected — it makes no crawl-job calls.

Fix

Two complementary, low-risk changes (default behaviour for all other callers unchanged):

  1. Gate the getCrawlJob call on source_url (FileDetailsDialog.vue). source_url is empty for regular uploads and a URL for link/crawl-origin files, so the request is now skipped entirely for non-crawl documents — eliminating the 404, the toast, and the console noise for the reported case.
  2. Opt-in { silent: true } on httpService (httpService.js) — suppresses the user-facing error toast when a non-success response is an expected, handled outcome (rejection + console log still occur). Applied to the crawl-job/metrics/logs lookups as defence-in-depth for crawl-origin files whose job is absent.

Tests

  • FileDetailsDialog: gating — getCrawlJob not called when source_url empty/null; called when set.
  • documentFileService: getCrawlJob/getCrawlMetrics/getCrawlLogs pass { silent: true }.
  • httpService: error interceptor shows the toast by default, suppresses it when config.silent is true.

Full frontend suite: 1228 tests pass (1223 baseline + 5 new). eslint src/ and prettier --check clean.

Edited by Jérôme Revillard

Merge request reports

Loading