@nger/fk-upload 1.0.26 → 1.0.27
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.
@@ -70,14 +70,14 @@ let TaskService = class TaskService {
|
|
70
70
|
async createDownLoadTask(url, fkLoginId, topicId) {
|
71
71
|
const hash = await (0, multihashing_async_1.default)(Buffer.from(url), 'sha1', 16);
|
72
72
|
const cid = new cids_1.default(1, 'raw', hash, 'base64');
|
73
|
-
const filename = cid.toString('base64');
|
73
|
+
const filename = encodeURIComponent(cid.toString('base64'));
|
74
74
|
const _url = new URL(url);
|
75
75
|
const filePath = _url.pathname;
|
76
76
|
const ext = (0, path_1.extname)(filePath);
|
77
77
|
const task = new entities_1.FkDownloadTaskEntity();
|
78
78
|
const root = this.injector.get(core_1.APP_ROOT);
|
79
79
|
(0, fs_extra_1.ensureDirSync)((0, path_1.join)(root, 'attachments/fk-upload'));
|
80
|
-
const path = (0, path_1.join)(root, 'attachments/fk-upload',
|
80
|
+
const path = (0, path_1.join)(root, 'attachments/fk-upload', filename + ext);
|
81
81
|
task.filename = filename + ext;
|
82
82
|
task.url = url;
|
83
83
|
task.loginId = fkLoginId;
|
@@ -170,9 +170,9 @@ let TaskService = class TaskService {
|
|
170
170
|
formdata.append('isFreeVer', this.encodeURIComponent(false));
|
171
171
|
formdata.append('aid', this.encodeURIComponent(task.aid));
|
172
172
|
formdata.append('folderId', this.encodeURIComponent(task.folderId));
|
173
|
-
formdata.append('fileName',
|
173
|
+
formdata.append('fileName', task.filename);
|
174
174
|
formdata.append(`totalSize`, this.encodeURIComponent(task.total));
|
175
|
-
formdata.append(`fileMd5`,
|
175
|
+
formdata.append(`fileMd5`, task.fileMd5);
|
176
176
|
formdata.append('index', this.encodeURIComponent(task.index));
|
177
177
|
formdata.append('chunkSize', this.encodeURIComponent(task.splitSize));
|
178
178
|
formdata.append('totalChunks', this.encodeURIComponent(task.totalChunks));
|
@@ -180,7 +180,7 @@ let TaskService = class TaskService {
|
|
180
180
|
const bssInfo = {
|
181
181
|
fromSite: true, siteId: 0, groupId: 0, fileSizeLimit: 1024
|
182
182
|
};
|
183
|
-
formdata.append('bssInfo',
|
183
|
+
formdata.append('bssInfo', JSON.stringify(bssInfo));
|
184
184
|
const headers = formdata.getHeaders();
|
185
185
|
const uploadResult = await axios_1.default.post(task.uploadUrl, formdata, {
|
186
186
|
headers: {
|