Skip to content

Commit

Permalink
Base ISO cache file name on the full ISO URL
Browse files Browse the repository at this point in the history
Currently, only the final component of the URL path is used. This means
that minikube may use the wrong cached image after the user changes the
ISO URL to another with the same final component.

Base the cache file name on the full URL instead, encoding it using Go's
base64.URLEncoding so it can be used as a file name on all platforms.

Signed-off-by: Alberto Faria <[email protected]>
  • Loading branch information
albertofaria committed Apr 24, 2024
1 parent 98bd6df commit abc0d3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/minikube/download/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ limitations under the License.
package download

import (
"encoding/base64"
"fmt"
"net/url"
"os"
"path"
"path/filepath"
"runtime"
"strings"
Expand Down Expand Up @@ -77,7 +77,9 @@ func localISOPath(u *url.URL) string {
return u.String()
}

return filepath.Join(detect.ISOCacheDir(), path.Base(u.Path))
name := base64.URLEncoding.EncodeToString([]byte(u.String()))

return filepath.Join(detect.ISOCacheDir(), name)
}

// ISO downloads and returns the path to the downloaded ISO
Expand Down

0 comments on commit abc0d3b

Please sign in to comment.