Skip to content

Commit 72c1825

Browse files
committed
Puppeteer _resolve_installed_browser_path: resolve alias via configured install_args
When the shim-first short-circuit was removed from ``default_abspath_handler``, ``load()`` started going through ``_resolve_installed_browser_path`` for every query. That helper computed the canonical browser name from ``bin_name + install_args``, but ``default_abspath_handler`` didn't forward any ``install_args``, so it fell back to ``[bin_name]`` — which meant ``load("chrome")`` looked for ``puppeteer-browsers list`` entries whose browser name was ``chrome``, missing installs that landed as ``chromium@latest`` via a ``{"chrome": {"install_args": ["chromium@latest"]}}`` override (exactly the scenario ``test_chrome_alias_installs_real_browser_binary`` exercises). Fix: when ``install_args`` isn't passed explicitly, fall back to ``self.get_install_args(bin_name)`` so the provider's own handler-overrides map the alias (``chrome`` → ``chromium@latest``) before ``_browser_name`` extracts the canonical package name.
1 parent 9be4a6c commit 72c1825

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

abxpkg/binprovider_puppeteer.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,14 @@ def _resolve_installed_browser_path(
384384
install_args: Iterable[str] | None = None,
385385
no_cache: bool = False,
386386
) -> Path | None:
387-
browser_name = self._browser_name(bin_name, install_args or [bin_name])
387+
# Pick up the caller's configured install_args so
388+
# ``bin_name=chrome`` + ``install_args=["chromium@latest"]``
389+
# resolves to ``browser_name="chromium"`` (matching what
390+
# ``puppeteer-browsers list`` reports), instead of falling
391+
# back to ``[bin_name]`` which would look for the alias name.
392+
if install_args is None:
393+
install_args = self.get_install_args(bin_name, quiet=True) or [bin_name]
394+
browser_name = self._browser_name(bin_name, install_args)
388395
candidates = [
389396
(version, path)
390397
for candidate_browser, version, path in self._list_installed_browsers(

0 commit comments

Comments
 (0)