@nger/fk-upload 1.0.28 → 1.0.29

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,15 +70,17 @@ 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 = encodeURIComponent(cid.toString('base64'));
73
+ let filename = encodeURIComponent(cid.toString('base64'));
74
74
  const _url = new URL(url);
75
75
  const filePath = _url.pathname;
76
- const ext = (0, path_1.extname)(filePath);
76
+ let ext = (0, path_1.extname)(filePath);
77
+ console.log({ filePath, ext });
78
+ filename += ext === '.' ? '.mp4' : ext;
77
79
  const task = new entities_1.FkDownloadTaskEntity();
78
80
  const root = this.injector.get(core_1.APP_ROOT);
79
81
  (0, fs_extra_1.ensureDirSync)((0, path_1.join)(root, 'attachments/fk-upload'));
80
- const path = (0, path_1.join)(root, 'attachments/fk-upload', filename + ext);
81
- task.filename = filename + ext;
82
+ const path = (0, path_1.join)(root, 'attachments/fk-upload', filename);
83
+ task.filename = filename;
82
84
  task.url = url;
83
85
  task.loginId = fkLoginId;
84
86
  task.totalSize = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nger/fk-upload",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "",
5
5
  "main": "dist/core.js",
6
6
  "types": "dist/core.d.ts",