mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Fix: panics inside of task was not correctly logged into DB
Feat: slave node use new API to upload file to master
This commit is contained in:
@@ -26,6 +26,7 @@ type UploadTaskInfo struct {
|
||||
UploadSessionID *string
|
||||
AppendStart uint64
|
||||
Model interface{}
|
||||
Src string
|
||||
}
|
||||
|
||||
// FileHeader 上传来的文件数据处理器
|
||||
@@ -54,14 +55,23 @@ type FileStream struct {
|
||||
UploadSessionID *string
|
||||
AppendStart uint64
|
||||
Model interface{}
|
||||
Src string
|
||||
}
|
||||
|
||||
func (file *FileStream) Read(p []byte) (n int, err error) {
|
||||
return file.File.Read(p)
|
||||
if file.File != nil {
|
||||
return file.File.Read(p)
|
||||
}
|
||||
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
func (file *FileStream) Close() error {
|
||||
return file.File.Close()
|
||||
if file.File != nil {
|
||||
return file.File.Close()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (file *FileStream) Seek(offset int64, whence int) (int64, error) {
|
||||
@@ -85,6 +95,7 @@ func (file *FileStream) Info() *UploadTaskInfo {
|
||||
UploadSessionID: file.UploadSessionID,
|
||||
AppendStart: file.AppendStart,
|
||||
Model: file.Model,
|
||||
Src: file.Src,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user