zmdms-utils 0.0.93 → 0.0.94

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/es/file.js CHANGED
@@ -20,6 +20,7 @@ var isZmdmsFileService = FILE_SERVICE === "zmdms";
20
20
  */
21
21
  function downloadFile(fileId, fileName, options) {
22
22
  var API_BASEURL = options.API_BASEURL, authToken = options.authToken, _a = options.waterMark, waterMark = _a === void 0 ? true : _a, open = options.open, _b = options.parseErrorBlob, parseErrorBlob = _b === void 0 ? false : _b;
23
+ var originalFileId = fileId;
23
24
  if (isZmdmsFileService) {
24
25
  fileId = encodeFileId(fileId, 2);
25
26
  }
@@ -28,7 +29,7 @@ function downloadFile(fileId, fileName, options) {
28
29
  // 获取请求基础数据
29
30
  var _a = getBasicInfo(API_BASEURL, authToken), token = _a.token, apiBaseURL = _a.apiBaseURL;
30
31
  if (open) {
31
- xhr.open("GET", "".concat(apiBaseURL, "/api/").concat(BASIC_KEY, "-resource/oss/endpoint/public/download-file/").concat(fileId), true);
32
+ xhr.open("GET", "".concat(apiBaseURL, "/api/").concat(BASIC_KEY, "-resource/oss/endpoint/public/download-file/").concat(originalFileId), true);
32
33
  }
33
34
  else {
34
35
  xhr.open("GET", "".concat(apiBaseURL, "/api/").concat(BASIC_KEY, "-resource/oss/endpoint/download-file/").concat(fileId, "?").concat(TOKEN_KEY, "=").concat(token, "&addWaterMark=").concat(waterMark), true);
@@ -302,11 +303,13 @@ function createDownloadLink(fileId, options) {
302
303
  if (options === void 0) { options = {}; }
303
304
  var API_BASEURL = options.API_BASEURL, authToken = options.authToken, open = options.open;
304
305
  var _a = getBasicInfo(API_BASEURL || "", authToken), token = _a.token, apiBaseURL = _a.apiBaseURL;
306
+ var originalFileId = fileId;
305
307
  if (isZmdmsFileService) {
306
308
  fileId = encodeFileId(fileId, 2);
307
309
  }
308
310
  if (open) {
309
- return "".concat(apiBaseURL, "/api/").concat(BASIC_KEY, "-resource/oss/endpoint/public/download-file/").concat(fileId);
311
+ // 不需要权限的附件下载附件id不需要加密
312
+ return "".concat(apiBaseURL, "/api/").concat(BASIC_KEY, "-resource/oss/endpoint/public/download-file/").concat(originalFileId);
310
313
  }
311
314
  return "".concat(apiBaseURL, "/api/").concat(BASIC_KEY, "-resource/oss/endpoint/download-file/").concat(fileId, "?").concat(TOKEN_KEY, "=").concat(token);
312
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-utils",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/src/file.ts CHANGED
@@ -42,6 +42,7 @@ export function downloadFile(
42
42
  open,
43
43
  parseErrorBlob = false,
44
44
  } = options;
45
+ const originalFileId = fileId;
45
46
  if (isZmdmsFileService) {
46
47
  fileId = encodeFileId(fileId, 2);
47
48
  }
@@ -52,7 +53,7 @@ export function downloadFile(
52
53
  if (open) {
53
54
  xhr.open(
54
55
  "GET",
55
- `${apiBaseURL}/api/${BASIC_KEY}-resource/oss/endpoint/public/download-file/${fileId}`,
56
+ `${apiBaseURL}/api/${BASIC_KEY}-resource/oss/endpoint/public/download-file/${originalFileId}`,
56
57
  true,
57
58
  );
58
59
  } else {
@@ -377,11 +378,13 @@ export function createDownloadLink(
377
378
  ) {
378
379
  const { API_BASEURL, authToken, open } = options;
379
380
  const { token, apiBaseURL } = getBasicInfo(API_BASEURL || "", authToken);
381
+ const originalFileId = fileId;
380
382
  if (isZmdmsFileService) {
381
383
  fileId = encodeFileId(fileId, 2);
382
384
  }
383
385
  if (open) {
384
- return `${apiBaseURL}/api/${BASIC_KEY}-resource/oss/endpoint/public/download-file/${fileId}`;
386
+ // 不需要权限的附件下载附件id不需要加密
387
+ return `${apiBaseURL}/api/${BASIC_KEY}-resource/oss/endpoint/public/download-file/${originalFileId}`;
385
388
  }
386
389
  return `${apiBaseURL}/api/${BASIC_KEY}-resource/oss/endpoint/download-file/${fileId}?${TOKEN_KEY}=${token}`;
387
390
  }