Skip to content

Commit

Permalink
Fix file extension detection for files with multiple dot separators (#…
Browse files Browse the repository at this point in the history
…1408)

* Fix file extension detection for files with multiple dot separators

---------

Co-authored-by: Nerlih Max <[email protected]>
  • Loading branch information
nerlihmax and Nerlih Max authored Jan 18, 2025
1 parent 739b15a commit 9f4cbe6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion S3/S3.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,12 +728,14 @@ def content_type(self, filename=None, is_dir=False):
return content_type

def add_encoding(self, filename, content_type):
if not filename:
return False
if 'charset=' in content_type:
return False
exts = self.config.add_encoding_exts.split(',')
if exts[0]=='':
return False
parts = filename.rsplit('.',2)
parts = filename.rsplit('.', 1)
if len(parts) < 2:
return False
ext = parts[1]
Expand Down

0 comments on commit 9f4cbe6

Please sign in to comment.