Skip to content

Commit

Permalink
fix: don't use filename from URL when downloading manifest
Browse files Browse the repository at this point in the history
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 <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Feb 12, 2021
1 parent 1111edf commit ffe34ec
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions internal/app/machined/pkg/controllers/k8s/extra_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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{},
Expand Down

0 comments on commit ffe34ec

Please sign in to comment.