Skip to content

Commit

Permalink
Merge pull request #298 from application-research/uname-fix
Browse files Browse the repository at this point in the history
chore: fix the username taken validation
  • Loading branch information
alvin-reyes committed Jun 29, 2022
2 parents b34ddb9 + 035da3f commit 3c52780
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2880,7 +2880,7 @@ func (s *Server) handleRegisterUser(c echo.Context) error {
}
}

if exist != nil {
if exist != nil && strings.ToLower(exist.Username) == username {
return &util.HttpError{
Code: http.StatusBadRequest,
Reason: util.ERR_USERNAME_TAKEN,
Expand Down
8 changes: 6 additions & 2 deletions replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,10 @@ func (cm *ContentManager) checkDeal(ctx context.Context, d *contentDeal) (int, e
return DEAL_CHECK_PROGRESS, nil
}

if provds == nil {
return DEAL_CHECK_UNKNOWN, fmt.Errorf("failed to lookup provider deal state")
}

if provds.State == storagemarket.StorageDealError {
log.Errorf("deal state for deal %s from miner %s is error: %s",
statusCheckID, maddr.String(), provds.Message)
Expand All @@ -1605,12 +1609,12 @@ func (cm *ContentManager) checkDeal(ctx context.Context, d *contentDeal) (int, e

if provds.DealID != 0 {
deal, err := cm.Api.StateMarketStorageDeal(ctx, provds.DealID, types.EmptyTSK)
if err != nil {
if err != nil || deal == nil {
return DEAL_CHECK_UNKNOWN, fmt.Errorf("failed to lookup deal on chain: %w", err)
}

pcr, err := cm.lookupPieceCommRecord(content.Cid.CID)
if err != nil {
if err != nil || pcr == nil {
return DEAL_CHECK_UNKNOWN, xerrors.Errorf("failed to look up piece commitment for content: %w", err)
}

Expand Down

0 comments on commit 3c52780

Please sign in to comment.