Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4096 from pypeclub/bugfix/extension_case_insensitive
Browse files Browse the repository at this point in the history
Files Widget: Ignore case sensitivity of extensions
  • Loading branch information
iLLiCiTiT authored Nov 15, 2022
2 parents a45cba6 + 20ea1c8 commit ffac58e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions openpype/lib/attribute_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,13 @@ def ext(self):
return ext
return None

@property
def lower_ext(self):
ext = self.ext
if ext is not None:
return ext.lower()
return ext

@property
def is_dir(self):
if self.is_empty:
Expand Down
6 changes: 3 additions & 3 deletions openpype/tools/attribute_defs/files_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def _create_item(self, file_item):
item.setData(file_item.filenames, FILENAMES_ROLE)
item.setData(file_item.directory, DIRPATH_ROLE)
item.setData(icon_pixmap, ITEM_ICON_ROLE)
item.setData(file_item.ext, EXT_ROLE)
item.setData(file_item.lower_ext, EXT_ROLE)
item.setData(file_item.is_dir, IS_DIR_ROLE)
item.setData(file_item.is_sequence, IS_SEQUENCE_ROLE)

Expand Down Expand Up @@ -463,7 +463,7 @@ def are_valid_files(self, filepaths):
for filepath in filepaths:
if os.path.isfile(filepath):
_, ext = os.path.splitext(filepath)
if ext in self._allowed_extensions:
if ext.lower() in self._allowed_extensions:
return True

elif self._allow_folders:
Expand All @@ -475,7 +475,7 @@ def filter_valid_files(self, filepaths):
for filepath in filepaths:
if os.path.isfile(filepath):
_, ext = os.path.splitext(filepath)
if ext in self._allowed_extensions:
if ext.lower() in self._allowed_extensions:
filtered_paths.append(filepath)

elif self._allow_folders:
Expand Down

0 comments on commit ffac58e

Please sign in to comment.