Skip to content

Commit 5bd44f9

Browse files
authored
Fix 500 for conflicts when downstreaming a file from NextCloud (#4498)
2 parents 2cbb312 + a4e5a7b commit 5bd44f9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

model/nextcloud/nextcloud.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ func (nc *NextCloud) Downstream(path, dirID string, kind OperationKind, cozyMeta
252252
doc.CozyMetadata = cozyMetadata
253253

254254
fs := nc.inst.VFS()
255+
exists, err := fs.GetIndexer().DirChildExists(doc.DirID, doc.DocName)
256+
if err != nil {
257+
return nil, err
258+
}
259+
if exists {
260+
doc.DocName = vfs.ConflictName(fs, doc.DirID, doc.DocName, true)
261+
}
262+
255263
file, err := fs.CreateFile(doc, nil)
256264
if err != nil {
257265
return nil, err

0 commit comments

Comments
 (0)