Skip to content

Commit

Permalink
models.file:OriginalFile.get_action - if action is from alternatives,…
Browse files Browse the repository at this point in the history
… remove "extension mismatch" warning

Fix #56
  • Loading branch information
MatteoCampinoti94 committed Nov 27, 2024
1 parent 55e3620 commit 2b2b685
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions acacore/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,19 +451,23 @@ def get_action(
:return: The matched ``Action`` object, if any, otherwise ``None``.
"""
action: Action | None = get_identifier(self, file_classes, actions)
from_alternative: bool = False

if action and action.alternatives and (new_puid := action.alternatives.get(self.suffixes.lower(), None)):
puid: str | None = self.puid
self.puid = new_puid
if new_action := self.get_action(actions, file_classes):
action = new_action
from_alternative = True
else:
self.puid = puid

if set_match and action:
self.signature = action.name
self.action = action.action
self.action_data = action.action_data
if from_alternative and self.warning:
self.warning = [w for w in self.warning if w.lower() != "extension mismatch"]
elif set_match:
self.signature = self.signature if self.puid else None
self.action = None
Expand Down

0 comments on commit 2b2b685

Please sign in to comment.