Skip to content

Commit f0984b5

Browse files
committed
aws: account for AL2023 mirror.list not having newline
The previous mirror.list endpoints for AL1 and AL2 had newlines at the end which the code accounted for (by splitting on newlines and discounting the last entry). AL2023 doesn't have a new line so we were consuming the one url and then discounting it. This change trims the final newline if it exists and then splits on newlines. Signed-off-by: crozzy <joseph.crosland@gmail.com>
1 parent 165bf75 commit f0984b5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

aws/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ func (c *Client) getMirrors(ctx context.Context, list string) error {
204204
return fmt.Errorf("failed to read http body: %v", err)
205205
}
206206

207-
urls := strings.Split(string(body), "\n")
208-
urls = urls[:len(urls)-1]
207+
b := strings.TrimSuffix(string(body), "\n")
208+
urls := strings.Split(b, "\n")
209209

210210
for _, u := range urls {
211211
uu, err := url.Parse(u)

aws/testdata/mirrors_linux2023.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://cdn.amazonlinux.com/al2023/core/guids/46ff4933b89b948580f3b223b826fee3c1830b85885db3f7f90502c0ac99698c/x86_64/
1+
https://cdn.amazonlinux.com/al2023/core/guids/46ff4933b89b948580f3b223b826fee3c1830b85885db3f7f90502c0ac99698c/x86_64/

0 commit comments

Comments
 (0)