feat: auto fix address in alist & smb storages (#2582)

pull/2587/head
BoYanZh 2022-12-05 13:31:34 +08:00 committed by GitHub
parent 8c0dfe2f3d
commit dc8d5106f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -30,6 +30,9 @@ func (d *AListV2) Init(ctx context.Context, storage model.Storage) error {
if err != nil {
return err
}
if len(d.Addition.Address) > 0 && string(d.Addition.Address[len(d.Addition.Address)-1]) == "/" {
d.Addition.Address = d.Addition.Address[0 : len(d.Addition.Address)-1]
}
// TODO login / refresh token
//op.MustSaveDriverStorage(d)
return err

View File

@ -30,6 +30,9 @@ func (d *AListV3) Init(ctx context.Context, storage model.Storage) error {
if err != nil {
return err
}
if len(d.Addition.Address) > 0 && string(d.Addition.Address[len(d.Addition.Address)-1]) == "/" {
d.Addition.Address = d.Addition.Address[0 : len(d.Addition.Address)-1]
}
// TODO login / refresh token
//op.MustSaveDriverStorage(d)
return err

View File

@ -4,6 +4,7 @@ import (
"context"
"errors"
"path/filepath"
"strings"
"time"
"github.com/alist-org/alist/v3/internal/driver"
@ -34,6 +35,9 @@ func (d *SMB) Init(ctx context.Context, storage model.Storage) error {
if err != nil {
return err
}
if strings.Index(d.Addition.Address, ":") < 0{
d.Addition.Address = d.Addition.Address + ":445"
}
return d.initFS()
}