From 64431703b5bd56c5974543a8142c5228d88771af Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sat, 8 Jun 2024 14:00:55 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/classes.tartools.ts | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 5464dd9..169881e 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@push.rocks/smartarchive', - version: '4.0.34', + version: '4.0.35', description: 'A library for working with archive files, providing utilities for compressing and decompressing data.' } diff --git a/ts/classes.tartools.ts b/ts/classes.tartools.ts index 2119300..f14311a 100644 --- a/ts/classes.tartools.ts +++ b/ts/classes.tartools.ts @@ -21,12 +21,17 @@ export class TarTools { } ): Promise { return new Promise(async (resolve, reject) => { - let fileName = - optionsArg.fileName || optionsArg.content instanceof plugins.smartfile.SmartFile - ? (optionsArg.content as plugins.smartfile.SmartFile).relative - : null || optionsArg.content instanceof plugins.smartfile.StreamFile - ? (optionsArg.content as plugins.smartfile.StreamFile).relativeFilePath - : null || optionsArg.filePath; + let fileName: string | null = null; + + if (optionsArg.fileName) { + fileName = optionsArg.fileName; + } else if (optionsArg.content instanceof plugins.smartfile.SmartFile) { + fileName = (optionsArg.content as plugins.smartfile.SmartFile).relative; + } else if (optionsArg.content instanceof plugins.smartfile.StreamFile) { + fileName = (optionsArg.content as plugins.smartfile.StreamFile).relativeFilePath; + } else if (optionsArg.filePath) { + fileName = optionsArg.filePath; + } /** * contentByteLength is used to set the size of the entry in the tar file