Don't shadow file sharing functionality error
continuous-integration/drone/pr Build was killed Details

This commit is contained in:
Sarah Jamie Lewis 2022-08-26 10:57:35 -07:00
parent 085b414bd8
commit 2058a51579
1 changed files with 552 additions and 546 deletions

View File

@ -635,6 +635,11 @@ func handleImagePreviews(profile peer.CwtchPeer, ev *event.Event, conversationID
settings := ReadGlobalSettings()
fh, err := filesharing.PreviewFunctionalityGate(settings.Experiments)
// Short-circuit if file sharing is disabled
if err != nil {
return
}
// Short-circuit failures
// Don't autodownload images if the download path does not exist.
if settings.DownloadPath == "" {
@ -646,8 +651,9 @@ func handleImagePreviews(profile peer.CwtchPeer, ev *event.Event, conversationID
return
}
// Now look at the image preview experiment
imagePreviewsEnabled := settings.Experiments["filesharing-images"]
if err == nil && imagePreviewsEnabled {
if imagePreviewsEnabled {
var cm model.MessageWrapper
err := json.Unmarshal([]byte(ev.Data[event.Data]), &cm)
if err == nil && cm.Overlay == model.OverlayFileSharing {