Repository: usdAG/slipit (language: python)

Issue:
[Bug] Unexcepted exception occured.
 - slipit v1.0.0
 - Installed via pip
 - On Kali GNU/Linux Rolling, `Linux kali 5.18.0-kali5-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.5-1kali6 (2022-07-07) x86_64 GNU/Linux`
 - Python 3.10.5                                                                                                                                              

```
slipit --archive-type tgz test.tar.gz test.file 
[-] Unexcepted exception occured.
[-] 'NoneType' object has no attribute 'open'
```
With the --archive-type option, the tool fails with the above error message. A .tar.gz file is successfully create without the option.


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dc26261..053cf50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 
+## v1.0.1 - Aug 29, 2022
+
+### Changed
+
+* Fix `NoneType` error when using `--archive-type`
+
+
 ## v1.0.0 - Aug 25, 2022
 
 ### Initial Release
diff --git a/README.md b/README.md
index f7f72a0..bbbc37e 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ utility with an extended feature set and improved base functionality.
 
 ![](https://github.com/usdAG/slipit/workflows/main%20Python%20CI/badge.svg?branch=main)
 ![](https://github.com/usdAG/slipit/workflows/develop%20Python%20CI/badge.svg?branch=develop)
-[![](https://img.shields.io/badge/version-1.0.0-blue)](https://github.com/usdAG/slipit/releases)
+[![](https://img.shields.io/badge/version-1.0.1-blue)](https://github.com/usdAG/slipit/releases)
 [![](https://img.shields.io/badge/build%20system-pip-blue)](https://pypi.org/project/slipit)
 ![](https://img.shields.io/badge/python-9%2b-blue)
 [![](https://img.shields.io/badge/license-GPL%20v3.0-blue)](https://github.com/usdAG/slipit/blob/main/LICENSE)
@@ -69,7 +69,7 @@ usage: slipit [-h] [--archive-type {zip,tar,tgz,bz2}] [--clear] [--debug] [--dep
               [--overwrite] [--prefix string] [--multi] [--remove name] [--separator char] [--sequence seq]
               [--static content] [--symlink target] archive [filename ...]
 
-slipit v1.0.0 - Utility for creating ZipSlip archives.
+slipit v1.0.1 - Utility for creating ZipSlip archives.
 
 positional arguments:
   archive               target archive file
diff --git a/bin/slipit b/bin/slipit
index 3b6230a..1bacd6c 100755
--- a/bin/slipit
+++ b/bin/slipit
@@ -129,7 +129,7 @@ def get_provider(output_file: str) -> str:
         sys.exit(1)
 
 
-parser = argparse.ArgumentParser(description='''slipit v1.0.0 - Utility for creating ZipSlip archives.''')
+parser = argparse.ArgumentParser(description='''slipit v1.0.1 - Utility for creating ZipSlip archives.''')
 
 parser.add_argument('archive', help='target archive file')
 parser.add_argument('filename', nargs='*', help='filenames to include into the archive')
@@ -155,7 +155,7 @@ def main():
     archive = None
     error_code = 0
     args = parser.parse_args()
-    provider = ArchiveProvider.get_provider_ext(args.type) if args.type else get_provider(args.archive)
+    provider = ArchiveProvider.get_provider_ext('.' + args.type) if args.type else get_provider(args.archive)
 
     try:
         if args.clear:
diff --git a/setup.py b/setup.py
index 521c5a4..dbe1352 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
 
 setuptools.setup(
     name='slipit',
-    version='1.0.0',
+    version='1.0.1',
     url='https://github.com/usdAG/slipit',
     author='Tobias Neitzel (@qtc_de)',
     description='slipit - Utility for creating archives with path traversal elements',


Test patch:
diff --git a/tests/testcases/tar.yml b/tests/testcases/tar.yml
index c813c3d..1b50604 100644
--- a/tests/testcases/tar.yml
+++ b/tests/testcases/tar.yml
@@ -12,6 +12,7 @@ tester:
 variables:
   tmpfile: '/tmp/slipit-temporary-file'
   archive: '/tmp/slipit-temporary-archive.tar'
+  archive2: '/tmp/slipit-temporary-archive.zip'
 
 
 plugins:
@@ -22,6 +23,7 @@ plugins:
   - cleanup:
       items:
         - ${archive}
+        - ${archive2}
 
 
 tests:
@@ -308,3 +310,39 @@ tests:
             - '..\..\..\..\slipit-temporary-file' 
             - '../../../../../slipit-temporary-file' 
             - '..\..\..\..\..\slipit-temporary-file' 
+
+  - title: Create an archive with explicit type
+    description: |-
+      Create an archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - ${tmpfile}
+      - --archive-type
+      - tar
+
+    validators:
+      - error: False
+      - tar_contains:
+          archive: ${archive2}
+          files:
+            - filename: '..\..\..\..\..\..\slipit-temporary-file'
+              size: 12
+              type: REGTYPE
+
+  - title: List an archive with explicit type
+    description: |-
+      List an archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - --archive-type
+      - tar
+
+    validators:
+      - error: False
+      - contains:
+          values:
+            - '..\..\..\..\..\..\slipit-temporary-file'
diff --git a/tests/testcases/tarbz2.yml b/tests/testcases/tarbz2.yml
index 957db93..950158d 100644
--- a/tests/testcases/tarbz2.yml
+++ b/tests/testcases/tarbz2.yml
@@ -12,6 +12,7 @@ tester:
 variables:
   tmpfile: '/tmp/slipit-temporary-file'
   archive: '/tmp/slipit-temporary-archive.tar'
+  archive2: '/tmp/slipit-temporary-archive.zip'
 
 
 plugins:
@@ -22,6 +23,7 @@ plugins:
   - cleanup:
       items:
         - ${archive}
+        - ${archive2}
 
 
 tests:
@@ -308,3 +310,40 @@ tests:
             - '..\..\..\..\slipit-temporary-file' 
             - '../../../../../slipit-temporary-file' 
             - '..\..\..\..\..\slipit-temporary-file' 
+
+  - title: Create an archive with explicit type
+    description: |-
+      Create an archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - ${tmpfile}
+      - --archive-type
+      - bz2
+
+    validators:
+      - error: False
+      - tar_contains:
+          archive: ${archive2}
+          compression: bz2
+          files:
+            - filename: '..\..\..\..\..\..\slipit-temporary-file'
+              size: 12
+              type: REGTYPE
+
+  - title: List an archive with explicit type
+    description: |-
+      List an archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - --archive-type
+      - bz2
+
+    validators:
+      - error: False
+      - contains:
+          values:
+            - '..\..\..\..\..\..\slipit-temporary-file'
diff --git a/tests/testcases/targz.yml b/tests/testcases/targz.yml
index 5f6f0d6..04e54aa 100644
--- a/tests/testcases/targz.yml
+++ b/tests/testcases/targz.yml
@@ -12,6 +12,7 @@ tester:
 variables:
   tmpfile: '/tmp/slipit-temporary-file'
   archive: '/tmp/slipit-temporary-archive.tar'
+  archive2: '/tmp/slipit-temporary-archive.zip'
 
 
 plugins:
@@ -22,6 +23,7 @@ plugins:
   - cleanup:
       items:
         - ${archive}
+        - ${archive2}
 
 
 tests:
@@ -308,3 +310,40 @@ tests:
             - '..\..\..\..\slipit-temporary-file' 
             - '../../../../../slipit-temporary-file' 
             - '..\..\..\..\..\slipit-temporary-file' 
+
+  - title: Create an archive with explicit type
+    description: |-
+      Create an archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - ${tmpfile}
+      - --archive-type
+      - tgz
+
+    validators:
+      - error: False
+      - tar_contains:
+          archive: ${archive2}
+          compression: gz
+          files:
+            - filename: '..\..\..\..\..\..\slipit-temporary-file'
+              size: 12
+              type: REGTYPE
+
+  - title: List an archive with explicit type
+    description: |-
+      List an archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - --archive-type
+      - tgz
+
+    validators:
+      - error: False
+      - contains:
+          values:
+            - '..\..\..\..\..\..\slipit-temporary-file'
diff --git a/tests/testcases/zip.yml b/tests/testcases/zip.yml
index 1f63c63..1c4f454 100644
--- a/tests/testcases/zip.yml
+++ b/tests/testcases/zip.yml
@@ -12,6 +12,7 @@ tester:
 variables:
   tmpfile: '/tmp/slipit-temporary-file'
   archive: '/tmp/slipit-temporary-archive.zip'
+  archive2: '/tmp/slipit-temporary-archive.tar'
 
 
 plugins:
@@ -22,6 +23,7 @@ plugins:
   - cleanup:
       items:
         - ${archive}
+        - ${archive2}
 
 
 tests:
@@ -302,3 +304,39 @@ tests:
             - '..\..\..\..\slipit-temporary-file' 
             - '../../../../../slipit-temporary-file' 
             - '..\..\..\..\..\slipit-temporary-file' 
+
+  - title: Create an archive with explicit type
+    description: |-
+      Create a new archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - ${tmpfile}
+      - --archive-type
+      - zip
+
+    validators:
+      - error: False
+      - zip_contains:
+          archive: ${archive2}
+          files:
+            - filename: '..\..\..\..\..\..\slipit-temporary-file'
+              size: 12
+              type: FILE
+
+  - title: List archive with explicit type
+    description: |-
+      List an archive using --archive-type
+
+    command:
+      - slipit
+      - ${archive2}
+      - --archive-type
+      - zip
+
+    validators:
+      - error: False
+      - contains:
+          values:
+            - '..\..\..\..\..\..\slipit-temporary-file'