From 632fc235d65dcc2ddf7d887c86f09b3ccb55656c Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 5 Jul 2023 12:09:41 +0200 Subject: [PATCH] builder/dockerfile: use string-literals for easier grep'ing Use string-literal for reduce escaped quotes, which makes for easier grepping. While at it, also changed http -> https to keep some linters at bay. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 202907b14ca1a41341d2b128ce2f1a1cd8b2aa5e) Signed-off-by: Sebastiaan van Stijn --- builder/dockerfile/copy_test.go | 24 ++++++++++++------------ builder/dockerfile/copy_windows.go | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/builder/dockerfile/copy_test.go b/builder/dockerfile/copy_test.go index 5fce0bd4eb..e837ce07ad 100644 --- a/builder/dockerfile/copy_test.go +++ b/builder/dockerfile/copy_test.go @@ -53,31 +53,31 @@ func TestGetFilenameForDownload(t *testing.T) { expected string }{ { - path: "http://www.example.com/", + path: "https://www.example.com/", expected: "", }, { - path: "http://www.example.com/xyz", + path: "https://www.example.com/xyz", expected: "xyz", }, { - path: "http://www.example.com/xyz.html", + path: "https://www.example.com/xyz.html", expected: "xyz.html", }, { - path: "http://www.example.com/xyz/", + path: "https://www.example.com/xyz/", expected: "", }, { - path: "http://www.example.com/xyz/uvw", + path: "https://www.example.com/xyz/uvw", expected: "uvw", }, { - path: "http://www.example.com/xyz/uvw.html", + path: "https://www.example.com/xyz/uvw.html", expected: "uvw.html", }, { - path: "http://www.example.com/xyz/uvw/", + path: "https://www.example.com/xyz/uvw/", expected: "", }, { @@ -114,23 +114,23 @@ func TestGetFilenameForDownload(t *testing.T) { expected: "xyz.html", }, { - disposition: "attachment; filename=\"xyz\"", + disposition: `attachment; filename="xyz"`, expected: "xyz", }, { - disposition: "attachment; filename=\"xyz.html\"", + disposition: `attachment; filename="xyz.html"`, expected: "xyz.html", }, { - disposition: "attachment; filename=\"/xyz.html\"", + disposition: `attachment; filename="/xyz.html"`, expected: "xyz.html", }, { - disposition: "attachment; filename=\"/xyz/uvw\"", + disposition: `attachment; filename="/xyz/uvw"`, expected: "uvw", }, { - disposition: "attachment; filename=\"Naïve file.txt\"", + disposition: `attachment; filename="Naïve file.txt"`, expected: "Naïve file.txt", }, } diff --git a/builder/dockerfile/copy_windows.go b/builder/dockerfile/copy_windows.go index 1a3a488516..bca088da6e 100644 --- a/builder/dockerfile/copy_windows.go +++ b/builder/dockerfile/copy_windows.go @@ -15,8 +15,8 @@ import ( ) var pathDenyList = map[string]bool{ - "c:\\": true, - "c:\\windows": true, + `c:\`: true, + `c:\windows`: true, } func init() {