Skip to content
Snippets Groups Projects
Commit f4432932 authored by Travis Ralston's avatar Travis Ralston
Browse files

Don't convert nil values from singleflight

parent db1a6c6b
No related branches found
No related tags found
No related merge requests found
...@@ -130,7 +130,12 @@ func GetMedia(origin string, mediaId string, downloadRemote bool, blockForMedia ...@@ -130,7 +130,12 @@ func GetMedia(origin string, mediaId string, downloadRemote bool, blockForMedia
return vals return vals
}) })
return v.(*types.MinimalMedia), err var value *types.MinimalMedia
if v != nil {
value = v.(*types.MinimalMedia)
}
return value, err
} }
func FindMinimalMediaRecord(origin string, mediaId string, downloadRemote bool, ctx context.Context, log *logrus.Entry) (*types.MinimalMedia, error) { func FindMinimalMediaRecord(origin string, mediaId string, downloadRemote bool, ctx context.Context, log *logrus.Entry) (*types.MinimalMedia, error) {
...@@ -258,5 +263,10 @@ func FindMediaRecord(origin string, mediaId string, downloadRemote bool, ctx con ...@@ -258,5 +263,10 @@ func FindMediaRecord(origin string, mediaId string, downloadRemote bool, ctx con
return media, nil return media, nil
}) })
return v.(*types.Media), err var value *types.Media
if v != nil {
value = v.(*types.Media)
}
return value, err
} }
...@@ -59,7 +59,12 @@ func GetPreview(urlStr string, onHost string, forUserId string, atTs int64, ctx ...@@ -59,7 +59,12 @@ func GetPreview(urlStr string, onHost string, forUserId string, atTs int64, ctx
return result.preview, result.err return result.preview, result.err
}) })
return v.(*types.UrlPreview), err var value *types.UrlPreview
if v != nil {
value = v.(*types.UrlPreview)
}
return value, err
} }
func cachedPreviewToReal(cached *types.CachedUrlPreview) (*types.UrlPreview, error) { func cachedPreviewToReal(cached *types.CachedUrlPreview) (*types.UrlPreview, error) {
......
...@@ -193,7 +193,12 @@ func GetThumbnail(origin string, mediaId string, desiredWidth int, desiredHeight ...@@ -193,7 +193,12 @@ func GetThumbnail(origin string, mediaId string, desiredWidth int, desiredHeight
return vals return vals
}) })
return v.(*types.StreamedThumbnail), err var value *types.StreamedThumbnail
if v != nil {
value = v.(*types.StreamedThumbnail)
}
return value, err
} }
func GetOrGenerateThumbnail(media *types.Media, width int, height int, animated bool, method string, ctx context.Context, log *logrus.Entry) (*types.Thumbnail, error) { func GetOrGenerateThumbnail(media *types.Media, width int, height int, animated bool, method string, ctx context.Context, log *logrus.Entry) (*types.Thumbnail, error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment