Skip to content

Commit

Permalink
cli[patch]: Modified regular expression (langchain-ai#19449)
Browse files Browse the repository at this point in the history
- **Description:** Modified regular expression to add support for
unicode chars and simplify pattern

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
  • Loading branch information
2 people authored and chrispy-snps committed Mar 30, 2024
1 parent 9f07dba commit b56b37f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/cli/langchain_cli/utils/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _get_repo_path(gitstring: str, ref: Optional[str], repo_dir: Path) -> Path:
removed_protocol = gitstring.split("://")[-1]
removed_basename = re.split(r"[/:]", removed_protocol, 1)[-1]
removed_extras = removed_basename.split("#")[0]
foldername = re.sub(r"[^a-zA-Z0-9_]", "_", removed_extras)
foldername = re.sub(r"\W", "_", removed_extras)

directory_name = f"{foldername}_{hashed}"
return repo_dir / directory_name
Expand Down

0 comments on commit b56b37f

Please sign in to comment.