# Buggy code
def from_dist_str(cls, dist_str):
    parts = {}
    if dist_str.endswith(CONDA_PACKAGE_EXTENSION_V1):
        dist_str = dist_str[: -len(CONDA_PACKAGE_EXTENSION_V1)]
    if "::" in dist_str:
        channel_subdir_str, dist_str = dist_str.split("::", 1)
        if "/" in channel_subdir_str:
            channel_str, subdir = channel_subdir_str.split("/", 2)
            parts.update(
                {
                    "channel": channel_str,
                    "subdir": subdir,
                }
            )
        else:
            parts["channel"] = channel_subdir_str

    name, version, build = dist_str.rsplit("-", 2)
    parts.update(
        {
            "name": name,
            "version": version,
            "build": build,
        }
    )
    return cls(**parts)


# Traceback (ValueError)
Traceback (most recent call last):
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1079, in __call__
return func(*args, **kwargs)
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
exit_code = do_call(args, p)
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 82, in do_call
return getattr(module, func_name)(args, parser)
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/cli/main_install.py", line 20, in execute
install(args, parser, 'install')
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/cli/install.py", line 250, in install
index)
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/plan.py", line 289, in revert_actions
target_state = {MatchSpec.from_dist_str(dist_str) for dist_str in h.get_state(revision)}
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/plan.py", line 289, in <setcomp>
target_state = {MatchSpec.from_dist_str(dist_str) for dist_str in h.get_state(revision)}
File "/Users/christian/miniconda3/lib/python3.6/site-packages/conda/models/match_spec.py", line 186, in from_dist_str
channel_str, subdir = channel_subdir_str.split('/', 2)
ValueError: too many values to unpack (expected 2)

# Fixed code
def from_dist_str(cls, dist_str):
    parts = {}
    if dist_str[-len(CONDA_PACKAGE_EXTENSION_V2) :] == CONDA_PACKAGE_EXTENSION_V2:
        dist_str = dist_str[: -len(CONDA_PACKAGE_EXTENSION_V2)]
    elif dist_str[-len(CONDA_PACKAGE_EXTENSION_V1) :] == CONDA_PACKAGE_EXTENSION_V1:
        dist_str = dist_str[: -len(CONDA_PACKAGE_EXTENSION_V1)]
    if "::" in dist_str:
        channel_subdir_str, dist_str = dist_str.split("::", 1)
        if "/" in channel_subdir_str:
            channel_str, subdir = channel_subdir_str.rsplit("/", 1)
            if subdir not in context.known_subdirs:
                channel_str = channel_subdir_str
                subdir = None
            parts["channel"] = channel_str
            if subdir:
                parts["subdir"] = subdir
        else:
            parts["channel"] = channel_subdir_str

    name, version, build = dist_str.rsplit("-", 2)
    parts.update(
        {
            "name": name,
            "version": version,
            "build": build,
        }
    )
    return cls(**parts)