mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-23 03:55:00 +00:00
feat:OpaqueErrors
to hide error information (#2486)
* adds a new configuration option to hide all error message information from http requests --------- Signed-off-by: Dave Lee <dave@gray101.com>
This commit is contained in:
parent
17cf6c4a4d
commit
d072835796
10 changed files with 78 additions and 41 deletions
|
@ -12,7 +12,7 @@ func ExistsInPath(path string, s string) bool {
|
|||
return err == nil
|
||||
}
|
||||
|
||||
func inTrustedRoot(path string, trustedRoot string) error {
|
||||
func InTrustedRoot(path string, trustedRoot string) error {
|
||||
for path != "/" {
|
||||
path = filepath.Dir(path)
|
||||
if path == trustedRoot {
|
||||
|
@ -25,7 +25,7 @@ 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, filepath.Clean(basePath))
|
||||
return InTrustedRoot(c, filepath.Clean(basePath))
|
||||
}
|
||||
|
||||
// SanitizeFileName sanitizes the given filename
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue