Skip to content

Commit

Permalink
Use urljoin for update URLs construction
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <mattia.verga@tiscali.it>
  • Loading branch information
mattiaverga committed Feb 4, 2024
1 parent 00befe0 commit d222bf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions bodhi-server/bodhi/server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from datetime import date, datetime, timedelta
from functools import lru_cache
from textwrap import wrap
from urllib.parse import urljoin
import hashlib
import json
import os
import re
import time
import typing
Expand Down Expand Up @@ -3421,9 +3421,7 @@ def get_url(self):
Returns:
str: A URL.
"""
path = ['updates']
path.append(self.alias)
return os.path.join(*path)
return f'updates/{self.alias}'

def abs_url(self, request=None):
"""
Expand All @@ -3433,7 +3431,7 @@ def abs_url(self, request=None):
request (pyramid.request.Request or None): The current web request. Unused.
"""
base = config['base_address']
return os.path.join(base, self.get_url())
return urljoin(base, self.get_url())

url = abs_url

Expand Down
1 change: 1 addition & 0 deletions news/5566.bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use urljoin for update URLs construction

0 comments on commit d222bf4

Please sign in to comment.