@zero-library/common 3.1.4 → 3.1.5

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.
package/dist/index.cjs.js CHANGED
@@ -1560,11 +1560,19 @@ var MarkdownPreview_default = ({ fileUrl, searchValue, asPlainText }) => {
1560
1560
  if (res.status !== 200) {
1561
1561
  throw new Error(`\u8BF7\u6C42\u5931\u8D25\uFF0C\u72B6\u6001\u7801: ${res.status}`);
1562
1562
  }
1563
- const content2 = await res.text();
1564
- if (!content2) {
1563
+ const buffer = await res.arrayBuffer();
1564
+ let markdownText = "";
1565
+ try {
1566
+ const decoder = new TextDecoder("utf-8", { fatal: true });
1567
+ markdownText = decoder.decode(buffer);
1568
+ } catch (e) {
1569
+ const gbkDecoder = new TextDecoder("gbk");
1570
+ markdownText = gbkDecoder.decode(buffer);
1571
+ }
1572
+ if (!markdownText) {
1565
1573
  throw new Error("\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A");
1566
1574
  }
1567
- return content2;
1575
+ return markdownText;
1568
1576
  };
1569
1577
  const init = async () => {
1570
1578
  setContent("");