@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
package/package.json
CHANGED
|
@@ -228,7 +228,8 @@ export class OfflineUpload {
|
|
|
228
228
|
|
|
229
229
|
getSignature(serverUrl = this.serverUrl, opt) {
|
|
230
230
|
// path 前缀 oss-upload 文件目录
|
|
231
|
-
opt
|
|
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,
|
package/src/upload/ossUpload.ts
CHANGED
|
@@ -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
|
|
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-")
|
|
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
|
};
|