@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
|
-
|
73
|
+
let filename = encodeURIComponent(cid.toString('base64'));
|
74
74
|
const _url = new URL(url);
|
75
75
|
const filePath = _url.pathname;
|
76
|
-
|
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
|
81
|
-
task.filename = filename
|
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;
|