filesharing-fixes #95

Merged
dan merged 4 commits from filesharing-fixes into trunk 2022-09-07 17:00:53 +00:00
1 changed files with 552 additions and 546 deletions
Showing only changes of commit 2058a51579 - Show all commits

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 {