hazo_pdf 1.5.7 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4839,8 +4839,23 @@ ${suffix_line}`;
4839
4839
  setCachedPdfData(cached_copy);
4840
4840
  pdf_data = loaded_data;
4841
4841
  } else {
4842
- logger2.debug("[PdfViewer] Loading PDF via fetch, caching for extraction");
4842
+ logger2.debug("[PdfViewer] Loading PDF via fetch, caching for extraction", { url: effective_url });
4843
4843
  const response = await fetch(effective_url);
4844
+ if (!response.ok) {
4845
+ const error_text = await response.text().catch(() => "");
4846
+ const truncated = error_text.length > 200 ? error_text.slice(0, 200) + "..." : error_text;
4847
+ throw new Error(
4848
+ `Failed to fetch PDF (${response.status} ${response.statusText}): ${truncated || "No response body"}`
4849
+ );
4850
+ }
4851
+ const content_type = response.headers.get("content-type") || "";
4852
+ if (!content_type.includes("application/pdf") && !content_type.includes("application/octet-stream")) {
4853
+ logger2.warn("[PdfViewer] Unexpected content type for PDF", {
4854
+ url: effective_url,
4855
+ content_type,
4856
+ note: "Expected application/pdf or application/octet-stream"
4857
+ });
4858
+ }
4844
4859
  const array_buffer = await response.arrayBuffer();
4845
4860
  const cached_copy = array_buffer.slice(0);
4846
4861
  setCachedPdfData(cached_copy);
@@ -6137,4 +6152,4 @@ export {
6137
6152
  PdfViewer,
6138
6153
  pdf_viewer_default
6139
6154
  };
6140
- //# sourceMappingURL=chunk-FMZPXAJT.js.map
6155
+ //# sourceMappingURL=chunk-ROKBDX4O.js.map