mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
fix (path): default path when logging in - #151
This commit is contained in:
parent
404c3c01ce
commit
81d224f9e8
1 changed files with 10 additions and 10 deletions
|
|
@ -55,20 +55,20 @@ func GetHome(b IBackend, base string) (string, error) {
|
|||
if _, err := b.Ls(base); err != nil {
|
||||
return base, err
|
||||
}
|
||||
|
||||
|
||||
home := "/"
|
||||
if obj, ok := b.(interface{ Home() (string, error) }); ok {
|
||||
absolute, err := obj.Home()
|
||||
tmp, err := obj.Home()
|
||||
if err != nil {
|
||||
return "", err
|
||||
return base, err
|
||||
}
|
||||
absolute = EnforceDirectory(absolute)
|
||||
base = EnforceDirectory(base)
|
||||
if strings.HasPrefix(absolute, base) {
|
||||
return "/" + absolute[len(base):], nil
|
||||
}
|
||||
return "/", nil
|
||||
home = EnforceDirectory(tmp)
|
||||
}
|
||||
return base, nil
|
||||
base = EnforceDirectory(base)
|
||||
if strings.HasPrefix(home, base) {
|
||||
return "/" + home[len(base):], nil
|
||||
}
|
||||
return "/", nil
|
||||
}
|
||||
|
||||
func MapStringInterfaceToMapStringString(m map[string]interface{}) map[string]string {
|
||||
|
|
|
|||
Loading…
Reference in a new issue