isdata-customer-sdk 0.1.78 → 0.1.79

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.umd.js CHANGED
@@ -29580,6 +29580,7 @@ __webpack_require__.d(__webpack_exports__, {
29580
29580
  getChildrenOfficeInfosByID: function() { return /* reexport */ getChildrenOfficeInfosByID; },
29581
29581
  getCurrentUserPortalPageID: function() { return /* reexport */ getCurrentUserPortalPageID; },
29582
29582
  getDifyFileType: function() { return /* reexport */ getDifyFileType; },
29583
+ getFileSize: function() { return /* reexport */ getFileSize; },
29583
29584
  getGroupMappingsByAccount: function() { return /* reexport */ getGroupMappingsByAccount; },
29584
29585
  getIMHanlder: function() { return /* reexport */ getIMHanlder; },
29585
29586
  getIntegrateAppInfoByID: function() { return /* reexport */ getIntegrateAppInfoByID; },
@@ -29632,16 +29633,6 @@ __webpack_require__.d(__webpack_exports__, {
29632
29633
  validateSSOPageLoaded: function() { return /* reexport */ validateSSOPageLoaded; }
29633
29634
  });
29634
29635
 
29635
- // NAMESPACE OBJECT: ./src/api/utils.js
29636
- var utils_namespaceObject = {};
29637
- __webpack_require__.r(utils_namespaceObject);
29638
- __webpack_require__.d(utils_namespaceObject, {
29639
- w$: function() { return createFileFromUrl; },
29640
- KQ: function() { return extractFilenameFromUrl; },
29641
- Ie: function() { return getUrlParamValue; },
29642
- Ju: function() { return queryAssetById; }
29643
- });
29644
-
29645
29636
  ;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
29646
29637
  /* eslint-disable no-var */
29647
29638
  // This file is imported into lib/wc client bundles.
@@ -30968,20 +30959,15 @@ const getFileSize = async url => {
30968
30959
  try {
30969
30960
  // 发送HEAD请求(不下载文件内容)
30970
30961
  const response = await fetch(url, {
30971
- method: 'HEAD'
30962
+ method: 'GET',
30963
+ headers: {
30964
+ 'Range': 'bytes=0-0'
30965
+ } // 仅请求第 1 个字节
30972
30966
  });
30973
-
30974
- // 检查响应状态
30975
- if (!response.ok) {
30976
- throw new Error(`请求失败,状态码: ${response.status}`);
30977
- }
30978
-
30979
- // 获取Content-Length头部
30980
- const contentLength = response.headers.get('Content-Length');
30981
- if (!contentLength) {
30982
- throw new Error('未找到Content-Length响应头');
30983
- }
30984
- return parseInt(contentLength, 10);
30967
+ if (response.status !== 206) throw new Error('不支持 Range 请求');
30968
+ const contentRange = response.headers.get('Content-Range');
30969
+ const totalSize = contentRange?.match(/\/(\d+)$/)?.[1]; // 解析总大小(如 "bytes 0-0/1000" → 1000)
30970
+ return totalSize ? parseInt(totalSize, 10) : -1;
30985
30971
  } catch (error) {
30986
30972
  console.error('获取文件大小失败:', error);
30987
30973
  return -1; // 返回-1表示失败
@@ -31457,14 +31443,14 @@ const getIMHanlder = customerHanlder => {
31457
31443
  getPortalDocmentInfo: async data => {
31458
31444
  let kb_doc_id = data.kb_doc_id;
31459
31445
  let doc_info = await getPortalDocmentInfo(kb_doc_id);
31460
- let urlStr = doc_info.summary;
31446
+ let urlStr = doc_info?.summary;
31461
31447
  if (urlStr) {
31462
31448
  let urlObj = JSON.parse(urlStr);
31463
- if (urlObj && urlObj.url) {
31449
+ if (urlObj) {
31464
31450
  let url = urlObj[0].url;
31465
31451
  let home_page = window.smardaten_api_context_path;
31466
31452
  let finalUrl = `${home_page}/storage_area/public${url}`;
31467
- let fileSize = await (0,utils_namespaceObject.getFileSize)(finalUrl);
31453
+ let fileSize = await getFileSize(finalUrl);
31468
31454
  doc_info.fileSize = fileSize;
31469
31455
  }
31470
31456
  }