mirror of https://github.com/Xhofe/alist
Refactor (driver): Optimize lock field type
- Changed the `IsLock` field type from `int` to `bool` for better semantics. - Updated the check logic to use direct Boolean comparisons to improve code readability and accuracy.pull/9311/head
parent
d6f002a133
commit
ca149ac10f
|
@ -55,7 +55,7 @@ func (d *Pan123) Drop(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Pan123) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
|
func (d *Pan123) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
|
||||||
if f, ok := dir.(File); ok && f.IsLock == 1 {
|
if f, ok := dir.(File); ok && f.IsLock {
|
||||||
if err := d.unlockSafeBox(f.FileId); err != nil {
|
if err := d.unlockSafeBox(f.FileId); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ type File struct {
|
||||||
Etag string `json:"Etag"`
|
Etag string `json:"Etag"`
|
||||||
S3KeyFlag string `json:"S3KeyFlag"`
|
S3KeyFlag string `json:"S3KeyFlag"`
|
||||||
DownloadUrl string `json:"DownloadUrl"`
|
DownloadUrl string `json:"DownloadUrl"`
|
||||||
IsLock int `json:"IsLock"`
|
IsLock bool `json:"IsLock"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f File) CreateTime() time.Time {
|
func (f File) CreateTime() time.Time {
|
||||||
|
|
Loading…
Reference in New Issue