Skip to content

Commit

Permalink
RSDK-5818: small edge case of empty MIMEType hint (viamrobotics#3257)
Browse files Browse the repository at this point in the history
Co-authored-by: Clyde Bazile <[email protected]>
  • Loading branch information
bhaney and bazile-clyde authored Nov 21, 2023
1 parent 413d9c5 commit 59ec2d9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gostream/media_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ func WithMIMETypeHint(ctx context.Context, mimeType string) context.Context {
// MIMETypeHint gets the hint of what MIME type to use in encoding; if nothing is
// set, the default provided is used.
func MIMETypeHint(ctx context.Context, defaultType string) string {
if val, ok := ctx.Value(contextValueMIMETypeHint).(string); ok {
return val
val, ok := ctx.Value(contextValueMIMETypeHint).(string)
if !ok || val == "" {
return defaultType
}
return defaultType
return val
}

0 comments on commit 59ec2d9

Please sign in to comment.