Skip to content

Commit

Permalink
merge sprint-1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitenjain14 committed Aug 30, 2023
2 parents db5bd8a + b7df47b commit 9ab7487
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,22 +427,22 @@ func (fsh *StorageHandler) CreateConnection(ctx context.Context, r *http.Request
return nil, common.NewError("invalid_parameters", "Invalid allocation id passed."+err.Error())
}

if !allocationObj.CanRename() {
return nil, common.NewError("prohibited_allocation_file_options", "Cannot rename data in this allocation.")
}

clientID := ctx.Value(constants.ContextKeyClient).(string)
_ = ctx.Value(constants.ContextKeyClientKey).(string)

if clientID == "" {
return nil, common.NewError("invalid_operation", "Invalid client")
}

if allocationObj.OwnerID != clientID && allocationObj.RepairerID != clientID {
return nil, common.NewError("invalid_operation", "Operation needs to be performed by the owner or the payer of the allocation")
}

valid, err := verifySignatureFromRequest(allocationTx, r.Header.Get(common.ClientSignatureHeader), allocationObj.OwnerPublicKey)
if !valid || err != nil {
return nil, common.NewError("invalid_signature", "Invalid signature")
}

if clientID == "" {
return nil, common.NewError("invalid_operation", "Invalid client")
}

connectionID := r.FormValue("connection_id")
if connectionID == "" {
return nil, common.NewError("invalid_parameters", "Invalid connection id passed")
Expand Down

0 comments on commit 9ab7487

Please sign in to comment.