mirror of
https://github.com/mudler/LocalAI.git
synced 2025-06-29 14:14:59 +00:00
refactor: use fmt.Errorf
This commit is contained in:
parent
e88949d9c3
commit
a90b324fb8
1 changed files with 3 additions and 4 deletions
|
@ -2,7 +2,6 @@ package gallery
|
|||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -85,7 +84,7 @@ func inTrustedRoot(path string, trustedRoot string) error {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
return errors.New("path is outside of trusted root")
|
||||
return fmt.Errorf("path is outside of trusted root")
|
||||
}
|
||||
|
||||
func verifyPath(path, basePath string) error {
|
||||
|
@ -93,12 +92,12 @@ func verifyPath(path, basePath string) error {
|
|||
|
||||
r, err := filepath.EvalSymlinks(c)
|
||||
if err != nil {
|
||||
return errors.New("unsafe or invalid path specified")
|
||||
return fmt.Errorf("unsafe or invalid path specified")
|
||||
}
|
||||
|
||||
err = inTrustedRoot(r, basePath)
|
||||
if err != nil {
|
||||
return errors.New("unsafe or invalid path specified")
|
||||
return fmt.Errorf("unsafe or invalid path specified")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue