Fix code scanning alert no. 1: Incomplete URL substring sanitization
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
@@ -967,11 +967,13 @@ class MarkItDown:
|
|||||||
- extension: specifies the file extension to use when interpreting the file. If None, infer from source (path, uri, content-type, etc.)
|
- extension: specifies the file extension to use when interpreting the file. If None, infer from source (path, uri, content-type, etc.)
|
||||||
"""
|
"""
|
||||||
# Handle GitHub issue URLs directly
|
# Handle GitHub issue URLs directly
|
||||||
if isinstance(source, str) and "github.com" in source and "/issues/" in source:
|
if isinstance(source, str):
|
||||||
github_token = kwargs.get("github_token", os.getenv("GITHUB_TOKEN"))
|
parsed_url = urlparse(source)
|
||||||
if not github_token:
|
if parsed_url.hostname == "github.com" and "/issues/" in parsed_url.path:
|
||||||
raise ValueError("GitHub token is required for GitHub issue conversion.")
|
github_token = kwargs.get("github_token", os.getenv("GITHUB_TOKEN"))
|
||||||
return GitHubIssueConverter().convert(issue_url=source, github_token=github_token)
|
if not github_token:
|
||||||
|
raise ValueError("GitHub token is required for GitHub issue conversion.")
|
||||||
|
return GitHubIssueConverter().convert(issue_url=source, github_token=github_token)
|
||||||
|
|
||||||
# Local path or url
|
# Local path or url
|
||||||
if isinstance(source, str):
|
if isinstance(source, str):
|
||||||
|
|||||||
Reference in New Issue
Block a user