From 59ec2d98c7d8b0b87a926f0af382cb0ee26e8149 Mon Sep 17 00:00:00 2001 From: Bijan Haney Date: Tue, 21 Nov 2023 23:22:45 +0100 Subject: [PATCH] RSDK-5818: small edge case of empty MIMEType hint (#3257) Co-authored-by: Clyde Bazile <34226620+bazile-clyde@users.noreply.github.com> --- gostream/media_utils.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gostream/media_utils.go b/gostream/media_utils.go index 38a25b2ea1b..32a4ffc3721 100644 --- a/gostream/media_utils.go +++ b/gostream/media_utils.go @@ -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 }