1
0
Fork 0
forked from Mirrors/gomuks

server/media: don't allow downloading encrypted media without flag

This commit is contained in:
Tulir Asokan 2024-10-23 15:59:14 +03:00
parent 68356a9ef1
commit 508f2252da

View file

@ -204,6 +204,9 @@ func (gmx *Gomuks) DownloadMedia(w http.ResponseWriter, r *http.Request) {
} else if (cacheEntry == nil || cacheEntry.EncFile == nil) && encrypted {
mautrix.MNotFound.WithMessage("Media encryption keys not found in cache").Write(w)
return
} else if cacheEntry != nil && cacheEntry.EncFile != nil && !encrypted {
mautrix.MNotFound.WithMessage("Tried to download encrypted media without encrypted flag").Write(w)
return
}
if gmx.downloadMediaFromCache(ctx, w, r, cacheEntry, false) {