Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

471 B
Raw Blame
import { retainRemoteFilePreview } from '@/session/remoteMediaDiskCacheExpo';

/** WKWebView cannot load a data URI through its native file-URL loader. */
export async function preparePdfPreviewSource(url: string): Promise<{ uri: string; release(): void }> {
  if (!/^(https?:\/\/|file:\/\/)/i.test(url) && !url.startsWith('data:application/pdf;base64,'))
    throw new Error('INVALID_PDF_URL');
  return retainRemoteFilePreview(url, 'application/pdf', 'preview.pdf');
}