mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-24 06:14:04 +08:00
feat(url-tree)支持PUT
This commit is contained in:
parent
3375c26c41
commit
83c7d98772
@ -243,7 +243,25 @@ func (d *Urls) PutURL(ctx context.Context, dstDir model.Obj, name, url string) (
|
||||
}
|
||||
|
||||
func (d *Urls) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error {
|
||||
return errs.UploadNotSupported
|
||||
if !d.Writable {
|
||||
return errs.PermissionDenied
|
||||
}
|
||||
d.mutex.Lock()
|
||||
defer d.mutex.Unlock()
|
||||
node := GetNodeFromRootByPath(d.root, dstDir.GetPath()) // parent
|
||||
if node == nil {
|
||||
return errs.ObjectNotFound
|
||||
}
|
||||
if node.isFile() {
|
||||
return errs.NotFolder
|
||||
}
|
||||
file, err := parseFileLine(stream.GetName(), d.HeadSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
node.Children = append(node.Children, file)
|
||||
d.updateStorage()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *Urls) updateStorage() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user