Skip to content

Commit

Permalink
Update file.go
Browse files Browse the repository at this point in the history
Signed-off-by: 刘海涛 <[email protected]>
  • Loading branch information
lht2017 authored Apr 24, 2024
1 parent 11d464f commit a6d9a47
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions content/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,14 @@ func (s *Store) resolveWritePath(name string) (string, error) {
if strings.HasPrefix(rel, "../") || rel == ".." {
return "", ErrPathTraversalDisallowed
}
} else {
base, err := filepath.Abs(s.workingDir)
if err != nil {
return "", err
} else {
path = base
}

}
if s.DisableOverwrite {
if _, err := os.Stat(path); err == nil {
Expand Down

0 comments on commit a6d9a47

Please sign in to comment.