Skip to content

Commit

Permalink
Fix 500 for conflicts when downstreaming a file from NextCloud (#4498)
Browse files Browse the repository at this point in the history
  • Loading branch information
nono authored Dec 4, 2024
2 parents 2cbb312 + a4e5a7b commit 5bd44f9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions model/nextcloud/nextcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ func (nc *NextCloud) Downstream(path, dirID string, kind OperationKind, cozyMeta
doc.CozyMetadata = cozyMetadata

fs := nc.inst.VFS()
exists, err := fs.GetIndexer().DirChildExists(doc.DirID, doc.DocName)
if err != nil {
return nil, err
}
if exists {
doc.DocName = vfs.ConflictName(fs, doc.DirID, doc.DocName, true)
}

file, err := fs.CreateFile(doc, nil)
if err != nil {
return nil, err
Expand Down

0 comments on commit 5bd44f9

Please sign in to comment.