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.
@@ -29570,6 +29570,7 @@ __webpack_require__.d(__webpack_exports__, {
29570
29570
  getChildrenOfficeInfosByID: function() { return /* reexport */ getChildrenOfficeInfosByID; },
29571
29571
  getCurrentUserPortalPageID: function() { return /* reexport */ getCurrentUserPortalPageID; },
29572
29572
  getDifyFileType: function() { return /* reexport */ getDifyFileType; },
29573
+ getFileSize: function() { return /* reexport */ getFileSize; },
29573
29574
  getGroupMappingsByAccount: function() { return /* reexport */ getGroupMappingsByAccount; },
29574
29575
  getIMHanlder: function() { return /* reexport */ getIMHanlder; },
29575
29576
  getIntegrateAppInfoByID: function() { return /* reexport */ getIntegrateAppInfoByID; },
@@ -29622,16 +29623,6 @@ __webpack_require__.d(__webpack_exports__, {
29622
29623
  validateSSOPageLoaded: function() { return /* reexport */ validateSSOPageLoaded; }
29623
29624
  });
29624
29625
 
29625
- // NAMESPACE OBJECT: ./src/api/utils.js
29626
- var utils_namespaceObject = {};
29627
- __webpack_require__.r(utils_namespaceObject);
29628
- __webpack_require__.d(utils_namespaceObject, {
29629
- w$: function() { return createFileFromUrl; },
29630
- KQ: function() { return extractFilenameFromUrl; },
29631
- Ie: function() { return getUrlParamValue; },
29632
- Ju: function() { return queryAssetById; }
29633
- });
29634
-
29635
29626
  ;// ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
29636
29627
  /* eslint-disable no-var */
29637
29628
  // This file is imported into lib/wc client bundles.
@@ -30958,20 +30949,15 @@ const getFileSize = async url => {
30958
30949
  try {
30959
30950
  // 发送HEAD请求(不下载文件内容)
30960
30951
  const response = await fetch(url, {
30961
- method: 'HEAD'
30952
+ method: 'GET',
30953
+ headers: {
30954
+ 'Range': 'bytes=0-0'
30955
+ } // 仅请求第 1 个字节
30962
30956
  });
30963
-
30964
- // 检查响应状态
30965
- if (!response.ok) {
30966
- throw new Error(`请求失败,状态码: ${response.status}`);
30967
- }
30968
-
30969
- // 获取Content-Length头部
30970
- const contentLength = response.headers.get('Content-Length');
30971
- if (!contentLength) {
30972
- throw new Error('未找到Content-Length响应头');
30973
- }
30974
- return parseInt(contentLength, 10);
30957
+ if (response.status !== 206) throw new Error('不支持 Range 请求');
30958
+ const contentRange = response.headers.get('Content-Range');
30959
+ const totalSize = contentRange?.match(/\/(\d+)$/)?.[1]; // 解析总大小(如 "bytes 0-0/1000" → 1000)
30960
+ return totalSize ? parseInt(totalSize, 10) : -1;
30975
30961
  } catch (error) {
30976
30962
  console.error('获取文件大小失败:', error);
30977
30963
  return -1; // 返回-1表示失败
@@ -31447,14 +31433,14 @@ const getIMHanlder = customerHanlder => {
31447
31433
  getPortalDocmentInfo: async data => {
31448
31434
  let kb_doc_id = data.kb_doc_id;
31449
31435
  let doc_info = await getPortalDocmentInfo(kb_doc_id);
31450
- let urlStr = doc_info.summary;
31436
+ let urlStr = doc_info?.summary;
31451
31437
  if (urlStr) {
31452
31438
  let urlObj = JSON.parse(urlStr);
31453
- if (urlObj && urlObj.url) {
31439
+ if (urlObj) {
31454
31440
  let url = urlObj[0].url;
31455
31441
  let home_page = window.smardaten_api_context_path;
31456
31442
  let finalUrl = `${home_page}/storage_area/public${url}`;
31457
- let fileSize = await (0,utils_namespaceObject.getFileSize)(finalUrl);
31443
+ let fileSize = await getFileSize(finalUrl);
31458
31444
  doc_info.fileSize = fileSize;
31459
31445
  }
31460
31446
  }