Fixup Logic for Custom Profile Image Downloads (restrict to Accepted contacts), stronger defaults #71
|
@ -456,16 +456,17 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
||||||
fsf, err := filesharing.FunctionalityGate(settings.Experiments)
|
fsf, err := filesharing.FunctionalityGate(settings.Experiments)
|
||||||
imagePreviewsEnabled := settings.Experiments["filesharing-images"]
|
imagePreviewsEnabled := settings.Experiments["filesharing-images"]
|
||||||
if err == nil && imagePreviewsEnabled && conversation.Accepted {
|
if err == nil && imagePreviewsEnabled && conversation.Accepted {
|
||||||
if _, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.complete", fileKey)); exists {
|
|
||||||
basepath := settings.DownloadPath
|
basepath := settings.DownloadPath
|
||||||
fp, _ := filesharing.GenerateDownloadPath(basepath, fileKey, true)
|
fp, mp := filesharing.GenerateDownloadPath(basepath, fileKey, true)
|
||||||
|
|
||||||
|
if _, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.complete", fileKey)); exists {
|
||||||
if _, err := os.Stat(fp); err == nil {
|
if _, err := os.Stat(fp); err == nil {
|
||||||
// file is marked as completed downloaded and exists...
|
// file is marked as completed downloaded and exists...
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
basepath := settings.DownloadPath
|
|
||||||
fp, mp := filesharing.GenerateDownloadPath(basepath, fileKey, true)
|
|
||||||
log.Debugf("Downloading Profile Image %v %v %v", fp, mp, fileKey)
|
log.Debugf("Downloading Profile Image %v %v %v", fp, mp, fileKey)
|
||||||
ev.Event.Data[event.FilePath] = fp
|
ev.Event.Data[event.FilePath] = fp
|
||||||
ev.Event.Data[event.FileDownloadFinished] = constants.False
|
ev.Event.Data[event.FileDownloadFinished] = constants.False
|
||||||
|
|
Reference in New Issue