openxiangda 1.0.153 → 1.0.154
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/openxiangda-skills/references/troubleshooting.md +18 -5
- package/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +41 -1
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.d.mts +2 -1
- package/packages/sdk/dist/components/index.d.ts +2 -1
- package/packages/sdk/dist/components/index.mjs +41 -1
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +40 -1
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +40 -1
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +40 -1
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.mjs +40 -1
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
|
@@ -3747,6 +3747,45 @@ var normalizePreviewBlobResponse = (response) => {
|
|
|
3747
3747
|
if (blob) return blob;
|
|
3748
3748
|
throw new Error(getBinaryResponseMessage(payload) || "\u6587\u4EF6\u5185\u5BB9\u54CD\u5E94\u4E0D\u662F\u4E8C\u8FDB\u5236\u6570\u636E");
|
|
3749
3749
|
};
|
|
3750
|
+
var isZipBytes = (bytes) => bytes.length >= 4 && bytes[0] === 80 && bytes[1] === 75 && (bytes[2] === 3 && bytes[3] === 4 || bytes[2] === 5 && bytes[3] === 6 || bytes[2] === 7 && bytes[3] === 8);
|
|
3751
|
+
var decodeBase64ZipBlob = async (blob) => {
|
|
3752
|
+
const prefix = (await blob.slice(0, 96).text()).replace(/^\uFEFF/, "").replace(/\s+/g, "");
|
|
3753
|
+
if (!prefix.startsWith("UEsDB")) return blob;
|
|
3754
|
+
if (blob.size > 32 * 1024 * 1024) {
|
|
3755
|
+
throw new Error("Base64 \u6587\u4EF6\u8D85\u8FC7\u6D4F\u89C8\u5668\u517C\u5BB9\u89E3\u7801\u4E0A\u9650");
|
|
3756
|
+
}
|
|
3757
|
+
const base64 = (await blob.text()).replace(/^\uFEFF/, "").replace(/\s+/g, "");
|
|
3758
|
+
if (!/^[A-Za-z0-9+/]+={0,2}$/.test(base64)) {
|
|
3759
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
3760
|
+
}
|
|
3761
|
+
let binary = "";
|
|
3762
|
+
try {
|
|
3763
|
+
binary = globalThis.atob(base64);
|
|
3764
|
+
} catch {
|
|
3765
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
3766
|
+
}
|
|
3767
|
+
const bytes = new Uint8Array(binary.length);
|
|
3768
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
3769
|
+
bytes[index] = binary.charCodeAt(index);
|
|
3770
|
+
}
|
|
3771
|
+
if (!isZipBytes(bytes)) {
|
|
3772
|
+
throw new Error("Base64 \u6587\u4EF6\u89E3\u7801\u540E\u4E0D\u662F\u6709\u6548\u7684 Office \u6587\u6863");
|
|
3773
|
+
}
|
|
3774
|
+
if (globalThis.btoa(binary).replace(/=+$/, "") !== base64.replace(/=+$/, "")) {
|
|
3775
|
+
throw new Error("\u6587\u4EF6\u5185\u5BB9\u662F\u65E0\u6548\u7684 Base64 \u4E8C\u8FDB\u5236\u6570\u636E");
|
|
3776
|
+
}
|
|
3777
|
+
return new Blob([bytes], { type: blob.type || "application/zip" });
|
|
3778
|
+
};
|
|
3779
|
+
var normalizePreviewBlobContent = async (response) => {
|
|
3780
|
+
const blob = normalizePreviewBlobResponse(response);
|
|
3781
|
+
if (String(blob.type || "").toLowerCase().includes("application/json")) {
|
|
3782
|
+
const payload = await blob.text().then((value) => JSON.parse(value)).catch(() => null);
|
|
3783
|
+
if (payload) {
|
|
3784
|
+
throw new Error(getBinaryResponseMessage(payload) || "\u6587\u4EF6\u5185\u5BB9\u8BF7\u6C42\u5931\u8D25");
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
return decodeBase64ZipBlob(blob);
|
|
3788
|
+
};
|
|
3750
3789
|
var isDirectStorageItem = (item) => item.provider === "oss" || item.uploadProvider === "oss" || item.uploadProvider === "builtin-oss" || Boolean(item.storageCode);
|
|
3751
3790
|
var getPreviewItemKey = (item, index = 0) => getAttachmentItemIdentity(item) || item.id || item.uid || `${item.name || "file"}-${index}`;
|
|
3752
3791
|
var getPreviewSourceUrl = (item) => item.previewUrl || item.publicUrl || item.url || "";
|
|
@@ -3920,7 +3959,7 @@ var prepareFilePreview = async (options) => {
|
|
|
3920
3959
|
};
|
|
3921
3960
|
var loadPreviewBlob = async (request, url) => {
|
|
3922
3961
|
const response = await request({ url, method: "get", responseType: "blob" });
|
|
3923
|
-
return
|
|
3962
|
+
return normalizePreviewBlobContent(response);
|
|
3924
3963
|
};
|
|
3925
3964
|
var convertHeicPreview = async (request, url) => {
|
|
3926
3965
|
const source = await loadPreviewBlob(request, url);
|