mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 17:41:57 +08:00
fix: cannot upload file to onedrive because file info not match (fix #1215)
Path in onedrive is not case-sensitive while Cloudreve cares, thus file size is not matching when finishing upload.
This commit is contained in:
2
assets
2
assets
Submodule assets updated: 335880b776...f2e1195873
@@ -379,10 +379,14 @@ func (fs *FileSystem) listObjects(ctx context.Context, parent string, files []mo
|
|||||||
// CreateDirectory 根据给定的完整创建目录,支持递归创建。如果目录已存在,则直接
|
// CreateDirectory 根据给定的完整创建目录,支持递归创建。如果目录已存在,则直接
|
||||||
// 返回已存在的目录。
|
// 返回已存在的目录。
|
||||||
func (fs *FileSystem) CreateDirectory(ctx context.Context, fullPath string) (*model.Folder, error) {
|
func (fs *FileSystem) CreateDirectory(ctx context.Context, fullPath string) (*model.Folder, error) {
|
||||||
if fullPath == "/" || fullPath == "." || fullPath == "" {
|
if fullPath == "." || fullPath == "" {
|
||||||
return nil, ErrRootProtected
|
return nil, ErrRootProtected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if fullPath == "/" {
|
||||||
|
return fs.User.Root()
|
||||||
|
}
|
||||||
|
|
||||||
// 获取要创建目录的父路径和目录名
|
// 获取要创建目录的父路径和目录名
|
||||||
fullPath = path.Clean(fullPath)
|
fullPath = path.Clean(fullPath)
|
||||||
base := path.Dir(fullPath)
|
base := path.Dir(fullPath)
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ func (service *OneDriveCallback) PreProcess(c *gin.Context) serializer.Response
|
|||||||
isSizeCheckFailed = false
|
isSizeCheckFailed = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if isSizeCheckFailed || info.GetSourcePath() != actualPath {
|
if isSizeCheckFailed || !strings.EqualFold(info.GetSourcePath(), actualPath) {
|
||||||
fs.Handler.(onedrive.Driver).Client.Delete(context.Background(), []string{info.GetSourcePath()})
|
fs.Handler.(onedrive.Driver).Client.Delete(context.Background(), []string{info.GetSourcePath()})
|
||||||
return serializer.Err(serializer.CodeUploadFailed, "文件信息不一致", err)
|
return serializer.Err(serializer.CodeUploadFailed, "文件信息不一致", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user