@hzab/utils 1.1.0 → 1.1.2

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/changelog.md CHANGED
@@ -1,3 +1,11 @@
1
+ # @hzab/utils@1.1.2
2
+
3
+ fix: opt?.params?.hasPrePath 支持关闭内部默认地址前缀
4
+
5
+ # @hzab/utils@1.1.1
6
+
7
+ fix: fileName 添加 hash 判断
8
+
1
9
  # @hzab/utils@1.1.0
2
10
 
3
11
  refactor: lodash 改为 lodash-es
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hzab/utils",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "utils",
5
5
  "main": "src",
6
6
  "scripts": {
@@ -228,7 +228,8 @@ export class OfflineUpload {
228
228
 
229
229
  getSignature(serverUrl = this.serverUrl, opt) {
230
230
  // path 前缀 oss-upload 文件目录
231
- opt.params.path = mergeDirStr("web-upload/", opt.params.path ?? opt.params.dir);
231
+ const prePath = opt?.params?.hasPrePath !== false ? "web-upload/" : "";
232
+ opt.params.dir = mergeDirStr(prePath, opt.params.path ?? opt.params.dir);
232
233
  return getSignature({
233
234
  ...opt,
234
235
  serverUrl,
@@ -7,7 +7,8 @@ import OssUploadUtil, { axios, IUploadOpt } from "./OssUploadUtil";
7
7
  class OssUpload extends OssUploadUtil {
8
8
  getSignature(serverUrl = this.serverUrl, opt) {
9
9
  // dir 前缀 oss-upload 文件目录
10
- opt.params.dir = mergeDirStr("web-upload/", opt.params.dir);
10
+ const prePath = opt?.params?.hasPrePath !== false ? "web-upload/" : "";
11
+ opt.params.dir = mergeDirStr(prePath, opt.params.dir);
11
12
  return this._getSignature(serverUrl, opt);
12
13
  }
13
14
 
@@ -78,7 +78,7 @@ export const getFileNameByFileObj = (file, opt: any) => {
78
78
 
79
79
 
80
80
  const hashStr = useHashName ? nanoidNumALetters() : "";
81
- const nm = mergeFileName(_fileName + "." + _ext, (_fileName.indexOf("~kid-") ? "" : `~kid-${hashStr}-${file.createTime || dayjs().valueOf()}-${ext}`));
81
+ const nm = mergeFileName(_fileName + "." + _ext, (_fileName.indexOf("~kid-") < 0 ? `~kid-${hashStr}-${file.createTime || dayjs().valueOf()}-${ext}` : ""));
82
82
 
83
83
  return nm;
84
84
  };