oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package workspace
2
3import (
4 "os"
5 "path/filepath"
6)
7
8func CanonicalSecurityPath(path string, invalid error) (string, error) {
9 tail := ""
10 for parent := path; ; parent = filepath.Dir(parent) {
11 real, err := filepath.EvalSymlinks(parent)
12 if err == nil {
13 return filepath.Join(real, tail), nil
14 }
15 if !os.IsNotExist(err) || parent == filepath.Dir(parent) {
16 return "", invalid
17 }
18 tail = filepath.Join(filepath.Base(parent), tail)
19 }
20}
21