Skip to content

Commit

Permalink
incoming/web: always trim fileID in cancel handler
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Apr 12, 2024
1 parent e8f7b6d commit e8a003d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/incoming/web/api_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func (c *FilesController) CancelFileHandler(w http.ResponseWriter, r *http.Reque
return
}

// Remove .ach suffix if the request added it
fileID = strings.TrimSuffix(fileID, ".ach")

ctx, span := telemetry.StartSpan(r.Context(), "cancel-file-handler", trace.WithAttributes(
attribute.String("achgateway.shardKey", shardKey),
attribute.String("achgateway.fileID", fileID),
Expand Down Expand Up @@ -231,9 +234,6 @@ func (c *FilesController) CancelFileHandler(w http.ResponseWriter, r *http.Reque
}

func (c *FilesController) cancelFile(ctx context.Context, shardKey, fileID string, waiter chan models.FileCancellationResponse) error {
// Remove .ach suffix if the request added it
fileID = strings.TrimSuffix(fileID, ".ach")

c.cancellationLock.Lock()
c.activeCancellations[fileID] = waiter
c.cancellationLock.Unlock()
Expand Down

0 comments on commit e8a003d

Please sign in to comment.