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

Commit

Permalink
Merge pull request #370 from CybercentreCanada/bugfix/leading-space
Browse files Browse the repository at this point in the history
Bugfix/leading space [dev]
  • Loading branch information
cccs-kevin authored Sep 11, 2023
2 parents 4ee5fc5 + 1c0b68d commit 80474bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cuckoo/cuckoo_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,9 @@ def _remove_illegal_characters_from_file_name(self) -> None:
self.log.debug(f"Renaming {self.file_name} because it contains one of {ILLEGAL_FILENAME_CHARS}")
self.file_name = ''.join(ch for ch in self.file_name if ch not in ILLEGAL_FILENAME_CHARS)

if self.file_name.startswith(" "):
self.file_name = self.file_name.lstrip()

def _assign_file_extension(self, kwargs: Dict[str, Any]) -> str:
"""
This method determines the correct file extension to the file to be submitted
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cuckoo_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ def test_decode_mime_encoded_file_name(test_file_name, correct_file_name, cuckoo

@staticmethod
def test_remove_illegal_characters_from_file_name(cuckoo_class_instance):
test_file_name = ''.join(ch for ch in ILLEGAL_FILENAME_CHARS) + "blah"
test_file_name = " " + ''.join(ch for ch in ILLEGAL_FILENAME_CHARS) + "blah"
correct_file_name = "blah"

cuckoo_class_instance.file_name = test_file_name
Expand Down

0 comments on commit 80474bf

Please sign in to comment.