Skip to content

Commit 7eb43a6

Browse files
committed
revised Extractor input file extension check
1 parent e409b9a commit 7eb43a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pcapkit/foundation/extraction.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ class Extractor(Generic[P]):
130130
#: Output format.
131131
_offmt: 'Formats'
132132

133+
#: List of potential PCAP file extentions.
134+
PCAP_EXT = ['.pcap', '.cap', '.pcapng']
135+
133136
##########################################################################
134137
# Defaults.
135138
##########################################################################
@@ -405,7 +408,7 @@ def make_name(cls, fin: 'str' = 'in.pcap', fout: 'str' = 'out', fmt: 'Formats' =
405408
406409
"""
407410
if extension: # pylint: disable=else-if-used
408-
ifnm = fin if os.path.splitext(fin)[1] == '.pcap' else f'{fin}.pcap'
411+
ifnm = fin if os.path.splitext(fin)[1] in cls.PCAP_EXT else f'{fin}.pcap'
409412
else:
410413
ifnm = fin
411414

0 commit comments

Comments
 (0)