Skip to content

Commit a20fd42

Browse files
authored
check uploaded file (#1381)
1 parent cf1641c commit a20fd42

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

code/go/0chain.net/blobbercore/allocation/file_changer_upload.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ func (nf *UploadFileChanger) applyChange(ctx context.Context, rootRef *reference
8080
}
8181
}
8282

83+
for _, child := range dirRef.Children {
84+
if child.Name == nf.Filename {
85+
return nil, common.NewError("duplicate_file", "File already exists")
86+
}
87+
}
88+
8389
newFile := &reference.Ref{
8490
ActualFileHash: nf.ActualHash,
8591
ActualFileHashSignature: nf.ActualFileHashSignature,

0 commit comments

Comments
 (0)