Skip to content
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: 1 addition & 1 deletion ci/kokoro/lib/vcpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ install_vcpkg() {
io::log "Downloading vcpkg into ${vcpkg_dir}..."
VCPKG_VERSION="$(<ci/etc/vcpkg-version.txt)"
url="https://github.com/microsoft/vcpkg/archive/${VCPKG_VERSION}.tar.gz"
if [[ "${VCPKG_VERSION}" =~ [0-9]{4}.[0-9]{2}.[0-9]{2} ]]; then
if [[ "${VCPKG_VERSION}" =~ [0-9]{4}\.[0-9]{2}\.[0-9]{2} ]]; then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The change to escape the dots (.) in the regular expression is a crucial correctness fix. In regex, an unescaped dot acts as a wildcard matching any character, which could lead to unintended matches for VCPKG_VERSION strings that are not in the YYYY.MM.DD format. Escaping them with \. ensures that only literal dots are matched, making the version detection robust and accurate for constructing the correct download URL.

# vcpkg uses date-like tags for releases
url="https://github.com/microsoft/vcpkg/archive/refs/tags/${VCPKG_VERSION}.tar.gz"
fi
Expand Down
2 changes: 1 addition & 1 deletion ci/kokoro/windows/lib/vcpkg.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function Install-Vcpkg {

$vcpkg_version = Get-Content -Path "${project_root}\ci\etc\vcpkg-version.txt"
$vcpkg_url = "https://github.com/microsoft/vcpkg/archive/${vcpkg_version}.zip"
if ($vcpkg_version -match "[0-9]{4}.[0-9]{2}.[0-9]{2}" ) {
if ($vcpkg_version -match "[0-9]{4}\.[0-9]{2}\.[0-9]{2}" ) {
$vcpkg_url = "https://github.com/microsoft/vcpkg/archive/refs/tags/${vcpkg_version}.zip"
}
Write-Host "$(Get-Date -Format o) Downloading vcpkg archive from $vcpkg_url"
Expand Down