Skip to content

Commit

Permalink
Fix: Model Gallery Downloads (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-gray101 authored Jul 30, 2023
1 parent 688f150 commit 5ce0f21
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/utils/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ func inTrustedRoot(path string, trustedRoot string) error {
// VerifyPath verifies that path is based in basePath.
func VerifyPath(path, basePath string) error {
c := filepath.Clean(filepath.Join(basePath, path))
return inTrustedRoot(c, basePath)
return inTrustedRoot(c, filepath.Clean(basePath))
}
7 changes: 4 additions & 3 deletions pkg/utils/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package utils

import (
"fmt"
"io/ioutil"
"io"
"net/http"
"os"
"strings"
)

Expand Down Expand Up @@ -32,7 +33,7 @@ func GetURI(url string, f func(url string, i []byte) error) error {
if strings.HasPrefix(url, "file://") {
rawURL := strings.TrimPrefix(url, "file://")
// Read the response body
body, err := ioutil.ReadFile(rawURL)
body, err := os.ReadFile(rawURL)
if err != nil {
return err
}
Expand All @@ -49,7 +50,7 @@ func GetURI(url string, f func(url string, i []byte) error) error {
defer response.Body.Close()

// Read the response body
body, err := ioutil.ReadAll(response.Body)
body, err := io.ReadAll(response.Body)
if err != nil {
return err
}
Expand Down

0 comments on commit 5ce0f21

Please sign in to comment.