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

Don't calculate blurhashes when we're not supposed to

parent e8e2f540
No related branches found
No related tags found
No related merge requests found
......@@ -12,11 +12,15 @@ import (
func CalculateBlurhashAsync(ctx rcontext.RequestContext, reader io.Reader, sha256hash string) chan struct{} {
var err error
bhChan := make(chan struct{})
opChan := make(chan struct{})
go func() {
//goland:noinspection GoUnhandledErrorResult
defer io.Copy(io.Discard, reader) // we need to flush the reader as we might end up blocking the upload
defer close(bhChan)
defer close(opChan)
if !ctx.Config.Features.MSC2448Blurhash.Enabled {
return
}
var img image.Image
img, err = imaging.Decode(reader)
......@@ -43,5 +47,5 @@ func CalculateBlurhashAsync(ctx rcontext.RequestContext, reader io.Reader, sha25
return
}
}()
return bhChan
return opChan
}
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