Skip to content

Commit

Permalink
Assets: default asset name to empty string
Browse files Browse the repository at this point in the history
Instead of allowing it to be given an explicit None.  The problem with
allowing None is that the name is given to Python's urlparse(), and it
has the behavior of returning either a ParseResult or a
ParseResultBytes depending on the input given.

To prevent having to add further logic on a large part of the asset
code, let's just normalize the input.

Reference: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse
Signed-off-by: Cleber Rosa <crosa@redhat.com>
  • Loading branch information
clebergnu committed Feb 12, 2021
1 parent eb421d4 commit 229d64f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion avocado/utils/asset.py
Expand Up @@ -62,7 +62,7 @@ def __init__(self, name, asset_hash=None, algorithm=None, locations=None,
:param expire: time in seconds for the asset to expire
:param metadata: metadata which will be saved inside metadata file
"""
self.name = name
self.name = name or ''
self.asset_hash = asset_hash

if isinstance(locations, str):
Expand Down

0 comments on commit 229d64f

Please sign in to comment.