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 basename of the URL path is used, which can be the
same for different URLs.

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 22, 2024
1 parent 98bd6df commit 3d22393
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 3d22393

Please sign in to comment.