mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 18:45:00 +00:00
refactor(template): isolate and add tests (#2069)
* refactor(template): isolate and add tests Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Signed-off-by: Dave <dave@gray101.com> Co-authored-by: Dave <dave@gray101.com>
This commit is contained in:
parent
852316c5a6
commit
27ec84827c
6 changed files with 218 additions and 95 deletions
|
@ -2,10 +2,16 @@ package utils
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ExistsInPath(path string, s string) bool {
|
||||
_, err := os.Stat(filepath.Join(path, s))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func inTrustedRoot(path string, trustedRoot string) error {
|
||||
for path != "/" {
|
||||
path = filepath.Dir(path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue