Skip to content

Commit

Permalink
fix support for \ in paths in PR comments (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanalgar authored Apr 2, 2024
1 parent b3788f5 commit 098e036
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions smarteditor-ghclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,16 @@ async def main():
file_types_regex = r"(" + '|'.join(re.escape(ext) for ext in SUPPORTED_FILE_TYPES) + r")"

if commit_match := re.search(
rf'/smarteditor\s+([\w/.\-]*[\w.\-]+{file_types_regex})\s+--commit', comment_body
rf'/smarteditor\s+([\w/.\-\\]*[\w.\-]+{file_types_regex})\s+--commit', comment_body
):
file_path = commit_match[1]
file_path = commit_match[1].replace('\\', '/')
logging.info(f"[{file_path}] Commit command identified")

await commit_edited_file(github_handler, file_path, pr_number)

elif file_path_match := re.search(
rf'/smarteditor\s+([\w/.\-]*[\w.\-]+{file_types_regex})', comment_body
rf'/smarteditor\s+([\w/.\-\\]*[\w.\-]+{file_types_regex})', comment_body
):
file_path = file_path_match[1]
file_path = file_path_match[1].replace('\\', '/')
logging.info(f"[{file_path}] File path identified")

async with aiohttp.ClientSession() as session:
Expand Down

0 comments on commit 098e036

Please sign in to comment.