# Buggy code
def canonical_name(self):
    for multiname, channels in iteritems(context.custom_multichannels):
        for channel in channels:
            if self.name == channel.name:
                return multiname

    for that_name in context.custom_channels:
        if tokenized_startswith(self.name.split("/"), that_name.split("/")):
            return self.name

    if any(
        c.location == self.location
        for c in concatv((context.channel_alias,), context.migrated_channel_aliases)
    ):
        return self.name

    # fall back to the equivalent of self.base_url
    # re-defining here because base_url for MultiChannel is None
    return "%s://%s/%s" % (self.scheme, self.location, self.name)


# Traceback (AttributeError)
Traceback (most recent call last):
File "C:\Miniconda3\lib\site-packages\conda\exceptions.py", line 479, in c
onda_exception_handler
return_value = func(*args, **kwargs)
File "C:\Miniconda3\lib\site-packages\conda\cli\main.py", line 145, in _ma
in
exit_code = args.func(args, p)
File "C:\Miniconda3\lib\site-packages\conda\cli\main_update.py", line 65,
in execute
install(args, parser, 'update')
File "C:\Miniconda3\lib\site-packages\conda\cli\install.py", line 308, in
install
update_deps=context.update_dependencies)
File "C:\Miniconda3\lib\site-packages\conda\plan.py", line 526, in install
_actions
force=force, always_copy=always_copy)
File "C:\Miniconda3\lib\site-packages\conda\plan.py", line 308, in ensure_
linked_actions
fetched_in = is_fetched(dist)
File "C:\Miniconda3\lib\site-packages\conda\install.py", line 727, in is_f
etched
for fn in package_cache().get(dist, {}).get('files', ()):
File "C:\Miniconda3\lib\site-packages\conda\install.py", line 675, in pack
age_cache
add_cached_package(pdir, url)
File "C:\Miniconda3\lib\site-packages\conda\install.py", line 633, in add_
cached_package
schannel = Channel(url).canonical_name
File "C:\Miniconda3\lib\site-packages\conda\models\channel.py", line 161,
in __call__
c = Channel.from_value(value)
File "C:\Miniconda3\lib\site-packages\conda\models\channel.py", line 211,
in from_value
return Channel.from_url(value)
File "C:\Miniconda3\lib\site-packages\conda\models\channel.py", line 196,
in from_url
return parse_conda_channel_url(url)
File "C:\Miniconda3\lib\site-packages\conda\models\channel.py", line 132,
in parse_conda_channel_url
configured_token) = _read_channel_configuration(scheme, host, port, path
)
File "C:\Miniconda3\lib\site-packages\conda\models\channel.py", line 122,
in _read_channel_configuration
return (Url(host=host, port=port).url.rstrip('/'), path.strip('/') or No
ne,
AttributeError: 'NoneType' object has no attribute 'strip'

# Fixed code
def canonical_name(self):
    for multiname, channels in iteritems(context.custom_multichannels):
        for channel in channels:
            if self.name == channel.name:
                return multiname

    for that_name in context.custom_channels:
        if self.name and tokenized_startswith(
            self.name.split("/"), that_name.split("/")
        ):
            return self.name

    if any(
        c.location == self.location
        for c in concatv((context.channel_alias,), context.migrated_channel_aliases)
    ):
        return self.name

    # fall back to the equivalent of self.base_url
    # re-defining here because base_url for MultiChannel is None
    return "%s://%s" % (self.scheme, join_url(self.location, self.name))