Skip to content

Commit ad32ac1

Browse files
authored
Windows: Make sure the URL is fully formed before attempting to download
This should prevent the 404 errors when the URL is malformed due to `dir` and `download` fields missing.
1 parent e2e70a0 commit ad32ac1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

nightly-main/windows/LTSC2022/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ RUN Write-Host -NoNewLine ('Downloading {0} ... ' -f ${env:VSB});
130130
# Install Swift toolchain.
131131
ARG SWIFT_RELEASE_METADATA=https://download.swift.org/development/windows10/latest-build.json
132132
RUN $Release = curl.exe -sL ${env:SWIFT_RELEASE_METADATA} | ConvertFrom-JSON; \
133+
Write-Host ('({0})' -f $Release); \
134+
Write-Host -NoNewLine 'Release metadata ... '; \
135+
if ($Release.dir -and $Release.download) { \
136+
Write-Host '✓'; \
137+
} else { \
138+
Write-Host '✘ Missing fields.'; \
139+
exit 1; \
140+
} \
133141
$SWIFT_URL = "\"https://download.swift.org/development/windows10/$($Release.dir)/$($Release.download)\""; \
134142
Write-Host -NoNewLine ('Downloading {0} ... ' -f ${SWIFT_URL}); \
135143
Invoke-WebRequest -Uri ${SWIFT_URL} -OutFile installer.exe; \

0 commit comments

Comments
 (0)