Skip to content

Commit

Permalink
Percent-decode package record URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Dec 2, 2024
1 parent 005d725 commit 6825ad8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
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")

0 comments on commit 6825ad8

Please sign in to comment.