Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions vulnerabilities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from collections import defaultdict
from functools import total_ordering
from http import HTTPStatus
from pathlib import Path
from typing import List
from typing import Optional
from typing import Tuple
Expand Down Expand Up @@ -543,6 +544,10 @@ def get_advisory_url(file, base_path, url):
"""
Return the advisory URL constructed by combining the base URL with the relative file path.
"""
if isinstance(file, str):
file = Path(file)
if isinstance(base_path, str):
base_path = Path(base_path)
relative_path = str(file.relative_to(base_path)).strip("/")
advisory_url = urljoin(url, relative_path)
return advisory_url
Expand Down