Skip to content

Commit

Permalink
fix(alias): don't auto flatten if it's a file
Browse files Browse the repository at this point in the history
  • Loading branch information
EtherealAO committed Dec 24, 2023
1 parent 4b7ce15 commit 6b7e1d3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions drivers/alias/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/alist-org/alist/v3/internal/driver"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/fs"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/pkg/utils"
)
Expand Down Expand Up @@ -41,10 +42,16 @@ func (d *Alias) Init(ctx context.Context) error {
d.pathMap[k] = append(d.pathMap[k], v)
}
if len(d.pathMap) == 1 {
for k := range d.pathMap {
for k, v := range d.pathMap {
d.oneKey = k
d.autoFlatten = true
if len(v) == 1 {
sourceObj, err := fs.Get(ctx, v[0], &fs.GetArgs{NoLog: true})
if err == nil && !sourceObj.IsDir() {
d.autoFlatten = false
}
}
}
d.autoFlatten = true
}
return nil
}
Expand Down

0 comments on commit 6b7e1d3

Please sign in to comment.