Check complete status against file existence
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
08774268a8
commit
50b7a43466
|
@ -460,16 +460,18 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string {
|
||||||
basepath := settings.DownloadPath
|
basepath := settings.DownloadPath
|
||||||
fp, mp := 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 value, exists := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.complete", fileKey)); exists && value == event.True {
|
||||||
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 ""
|
||||||
|
} else {
|
||||||
|
// the user probably deleted the file, mark completed as false...
|
||||||
|
profile.SetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.complete", fileKey), event.False)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|
||||||
fsf.DownloadFile(profile, conversation.ID, fp, mp, val, constants.ImagePreviewMaxSizeInBytes)
|
fsf.DownloadFile(profile, conversation.ID, fp, mp, val, constants.ImagePreviewMaxSizeInBytes)
|
||||||
} else {
|
} else {
|
||||||
// if image previews are disabled then ignore this event...
|
// if image previews are disabled then ignore this event...
|
||||||
|
|
Reference in New Issue