Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percent-decode package record URLs #583

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conda_libmamba_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from conda.common.constants import NULL
from conda.common.io import Spinner, time_recorder
from conda.common.path import paths_equal
from conda.common.url import percent_decode
from conda.core.solve import Solver
from conda.exceptions import (
CondaValueError,
Expand Down Expand Up @@ -634,6 +635,7 @@ def _package_info_to_package_record(
break
else:
url = pkg.package_url
url = percent_decode(url)
return PackageRecord(
name=pkg.name,
version=pkg.version,
Expand Down
3 changes: 0 additions & 3 deletions dev/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ boltons>=23.0.0
conda>=23.7.3
conda-forge::libmamba>=2.0.0
conda-forge::libmambapy>=2.0.0
# NOTE: jaimergp/label/conda-libmamba-solver-for-libmamba-v2 is a temporary hack
# to allow upgrades to libmamba v2. Remove once CLS with v2 compat is released.
jaimergp/label/conda-libmamba-solver-for-libmamba-v2::conda-libmamba-solver
16 changes: 16 additions & 0 deletions tests/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
)

from conda_libmamba_solver.exceptions import LibMambaUnsatisfiableError
from conda_libmamba_solver.solver import LibMambaSolver as Solver

from .utils import conda_subprocess

Expand Down Expand Up @@ -500,3 +501,18 @@ def test_install_virtual_packages(conda_cli, spec):
else:
raises = (UnsatisfiableError, PackagesNotFoundError)
conda_cli("create", "--dry-run", "--offline", spec, raises=raises)


def test_urls_are_percent_decoded(tmp_path):
solver = Solver(
prefix=tmp_path, channels=["conda-forge"], specs_to_add=["x264"], command="create"
)
records = solver.solve_final_state()
for record in records:
if record.name == "x264":
print(record.url)
assert "!" in record.url
assert "%" not in record.url
break
else:
pytest.fail("Solution didn't include x264")
Loading