Skip to content

Commit 55af2d3

Browse files
committed
Use removesuffix/removeprefix instead of strip for URL and alias parsing
Signed-off-by: eeshs <eeshsaxena@gmail.com>
1 parent 7cdf304 commit 55af2d3

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

vulnerabilities/management/commands/commit_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def create_pull_request(self, repo_url, branch, title, body, token):
152152
"""Create a pull request in the GitHub repository."""
153153

154154
url_parts = urlparse(repo_url).path
155-
path_parts = url_parts.strip("/").rstrip(".git").split("/")
155+
path_parts = url_parts.strip("/").removesuffix(".git").split("/")
156156

157157
if len(path_parts) >= 2:
158158
repo_owner = path_parts[0]

vulnerabilities/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ def url(self):
13451345
return f"https://github.com/advisories/{alias}"
13461346

13471347
if alias.startswith("NPM-"):
1348-
id = alias.lstrip("NPM-")
1348+
id = alias.removeprefix("NPM-")
13491349
return f"https://github.com/nodejs/security-wg/blob/main/vuln/npm/{id}.json"
13501350

13511351

@@ -2829,7 +2829,7 @@ def url(self):
28292829
return f"https://github.com/advisories/{alias}"
28302830

28312831
if alias.startswith("NPM-"):
2832-
id = alias.lstrip("NPM-")
2832+
id = alias.removeprefix("NPM-")
28332833
return f"https://github.com/nodejs/security-wg/blob/main/vuln/npm/{id}.json"
28342834

28352835

0 commit comments

Comments
 (0)