diff options
author | bobzel <zzzman@gmail.com> | 2023-12-28 11:17:43 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-12-28 11:17:43 -0500 |
commit | fa6214e763fc341ad355c95424ae76f14450d8ce (patch) | |
tree | 3fc3e1025ffefd15bc76687f8693c0da4a9ae560 /src/server/DashUploadUtils.ts | |
parent | 3f5a1d34d4aa90f605500d464660c896e8168808 (diff) |
fixed uploading unsupported file. changed admzip reference.
Diffstat (limited to 'src/server/DashUploadUtils.ts')
-rw-r--r-- | src/server/DashUploadUtils.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index cd9b635bd..0161a8d38 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -211,8 +211,8 @@ export namespace DashUploadUtils { const result = await UploadImage(filepath, basename(filepath)); return { source: file, result }; } - fs.unlink(path, () => {}); - return { source: file, result: { name: 'Unsupported image format', message: `Could not upload unsupported file (${name}). Please convert to an .jpg` } }; + fs.unlink(filepath, () => {}); + return { source: file, result: { name: 'Unsupported image format', message: `Could not upload unsupported file (${originalFilename}). Please convert to an .jpg` } }; case 'video': if (format.includes('x-matroska')) { console.log('case video'); @@ -247,15 +247,15 @@ export namespace DashUploadUtils { // ); // file.path = file.path.replace('.mov', '.mp4').replace('.MOV', '.mp4'); // format = '.mp4'; - fs.unlink(path, () => {}); - return { source: file, result: { name: 'Unsupported video format', message: `Could not upload unsupported file (${name}). Please convert to an .mp4` } }; + fs.unlink(filepath, () => {}); + return { source: file, result: { name: 'Unsupported video format', message: `Could not upload unsupported file (${originalFilename}). Please convert to an .mp4` } }; } } if (videoFormats.includes(format) || format.includes('.webm')) { return MoveParsedFile(file, Directory.videos); } - fs.unlink(path, () => {}); - return { source: file, result: { name: 'Unsupported video format', message: `Could not upload unsupported file (${name}). Please convert to an .mp4` } }; + fs.unlink(filepath, () => {}); + return { source: file, result: { name: 'Unsupported video format', message: `Could not upload unsupported file (${originalFilename}). Please convert to an .mp4` } }; case 'application': if (applicationFormats.includes(format)) { const val = UploadPdf(file); @@ -269,8 +269,8 @@ export namespace DashUploadUtils { if (audioFormats.includes(format)) { return UploadAudio(file, format); } - fs.unlink(path, () => {}); - return { source: file, result: { name: 'Unsupported audio format', message: `Could not upload unsupported file (${name}). Please convert to an .mp3` } }; + fs.unlink(filepath, () => {}); + return { source: file, result: { name: 'Unsupported audio format', message: `Could not upload unsupported file (${originalFilename}). Please convert to an .mp3` } }; case 'text': if (types[1] == 'csv') { return UploadCsv(file); @@ -278,7 +278,7 @@ export namespace DashUploadUtils { } console.log(red(`Ignoring unsupported file (${originalFilename}) with upload type (${type}).`)); - fs.unlink(path, () => {}); + fs.unlink(filepath, () => {}); return { source: file, result: new Error(`Could not upload unsupported file (${originalFilename}) with upload type (${type}).`) }; } @@ -615,13 +615,13 @@ export namespace DashUploadUtils { buffer = buffer2; } catch (e) {} return Jimp.read(buffer ?? fileIn) - .then(async img => { + .then(async (img:any) => { await Promise.all( sizes.filter(({ width }) => width) .map(({ width, suffix }) => img = img.resize(width, Jimp.AUTO).write(outputPath(suffix)) )); // prettier-ignore return writtenFiles; }) - .catch(e => { + .catch((e:any) => { console.log('ERROR' + e); return writtenFiles; }); |