Skip to content

Commit 160e3b5

Browse files
committed
Fix file extension detection for files with multiple dot separators
1 parent 10aea09 commit 160e3b5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

S3/S3.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -728,15 +728,14 @@ def content_type(self, filename=None, is_dir=False):
728728
return content_type
729729

730730
def add_encoding(self, filename, content_type):
731+
if not filename:
732+
return False
731733
if 'charset=' in content_type:
732734
return False
733735
exts = self.config.add_encoding_exts.split(',')
734736
if exts[0]=='':
735737
return False
736-
parts = filename.rsplit('.',2)
737-
if len(parts) < 2:
738-
return False
739-
ext = parts[1]
738+
ext = filename.rsplit('.', 1)[-1]
740739
if ext in exts:
741740
return True
742741
else:

0 commit comments

Comments
 (0)