diff --git a/web/src/lib/search/utils.ts b/web/src/lib/search/utils.ts index bdb98931..14aa85eb 100644 --- a/web/src/lib/search/utils.ts +++ b/web/src/lib/search/utils.ts @@ -6,6 +6,7 @@ import { SourceMetadata, } from "./interfaces"; import { DateRangePickerValue } from "@/components/dateRangeSelectors/AdminDateRangeSelector"; +import { toast } from "@opal/layouts"; export const buildFilters = ( sources: SourceMetadata[], @@ -32,6 +33,20 @@ export const openDocument = ( document: OnyxDocument, updatePresentingDocument?: (document: MinimalOnyxDocument) => void ) => { + // AIDO: documents synced from SMB/network shares (ingestion API) have no + // browsable link and no stored file to preview — a normal preview click would + // just fail. Instead, surface the logical path by copying it to the clipboard + // so the user can open the file directly on the share. + if (document.source_type === ValidSources.IngestionApi) { + const path = document.semantic_identifier || document.document_id; + if (path) { + void navigator.clipboard + ?.writeText(path) + .then(() => toast.success(path)) + .catch(() => undefined); + } + return; + } if (document.link) { window.open(document.link, "_blank"); } else if (