From ffe34ec100b1a2e1969f15c0dc3c39e5e75ace2e Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 12 Feb 2021 15:52:45 +0300 Subject: [PATCH] fix: don't use filename from URL when downloading manifest Manifest URL might be anything, including any GET parameters which might get into filename which might lead to 'filename too long' error. As each URL is downloaded to a separate temporary directory, there's no reason to use filename based on the URL. Signed-off-by: Andrey Smirnov --- internal/app/machined/pkg/controllers/k8s/extra_manifest.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/app/machined/pkg/controllers/k8s/extra_manifest.go b/internal/app/machined/pkg/controllers/k8s/extra_manifest.go index f4116a024..3f6f89907 100644 --- a/internal/app/machined/pkg/controllers/k8s/extra_manifest.go +++ b/internal/app/machined/pkg/controllers/k8s/extra_manifest.go @@ -141,8 +141,6 @@ func (ctrl *ExtraManifestController) download(ctx context.Context, r controller. defer os.RemoveAll(tmpDir) //nolint: errcheck - fileName := filepath.Base(manifest.URL) - // I wish we never used go-getter package, as it doesn't allow downloading into memory. // But there's not much we can do about it right now, as it supports lots of magic // users might rely upon now. @@ -166,7 +164,7 @@ func (ctrl *ExtraManifestController) download(ctx context.Context, r controller. client := &getter.Client{ Ctx: ctx, Src: manifest.URL, - Dst: filepath.Join(tmpDir, fileName), + Dst: filepath.Join(tmpDir, "manifest.yaml"), Pwd: tmpDir, Mode: getter.ClientModeFile, Options: []getter.ClientOption{},