Skip to content

Commit

Permalink
Fix #83
Browse files Browse the repository at this point in the history
Fix problem with spaces in artifact title when using grep command.
  • Loading branch information
prokaryont committed Jun 19, 2021
1 parent 6a1e060 commit 77629b6
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions kb/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,13 @@ def get_filename_parts_wo_prefix(
Returns:
The provided filename without the provided prefix
"""
filename_str = str(filename)
prefix_str = str(prefix_to_remove)
return tuple(filename_str.replace(prefix_str, '')
.replace("/", " ")
.replace("\\", " ")
.strip().split())
prefix_path = Path(prefix_to_remove)
file_path = Path(filename)

try:
return file_path.relative_to(prefix_path).parts
except ValueError:
file_path.parts


def grep_in_files(
Expand Down

0 comments on commit 77629b6

Please sign in to comment.