mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-05 15:57:05 +00:00
cargo: fix version parsing when state=latest (#12064)
* fix(cargo): fix greedy regex in get_latest_published_version Fixes #8949 * docs(cargo): add changelog fragment for #12064
This commit is contained in:
parent
c2485ea57b
commit
9cba458e3e
2 changed files with 5 additions and 1 deletions
|
|
@ -196,7 +196,7 @@ class Cargo:
|
|||
cmd = ["search", name, "--limit", "1"]
|
||||
data, dummy = self._exec(cmd, True, False, False)
|
||||
|
||||
match = re.search(r'"(.+)"', data)
|
||||
match = re.search(r"^" + re.escape(name) + r'\s*=\s*"([^"]+)"', data, re.MULTILINE)
|
||||
if not match:
|
||||
self.module.fail_json(msg=f"No published version for package {name} found")
|
||||
return match.group(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue