diff --git a/lib.go b/lib.go index 8823381..73ff576 100644 --- a/lib.go +++ b/lib.go @@ -775,7 +775,7 @@ func c_CheckDownloadStatus(profilePtr *C.char, profileLen C.int, fileKeyPtr *C.c func CheckDownloadStatus(profileOnion, fileKey string) { profile := application.GetPeer(profileOnion) path, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", fileKey)) - 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 { eventHandler.Push(event.NewEvent(event.FileDownloaded, map[event.Field]string{ ProfileOnion: profileOnion, event.FileKey: fileKey, diff --git a/utils/eventHandler.go b/utils/eventHandler.go index 981533f..1e80136 100644 --- a/utils/eventHandler.go +++ b/utils/eventHandler.go @@ -260,7 +260,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string { func GetProfileImage(profile peer.CwtchPeer, conversationInfo *model.Conversation, basepath string) string { fileKey, err := profile.GetConversationAttribute(conversationInfo.ID, attr.PublicScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants.CustomProfileImageKey))) if err == nil { - 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 { fp, _ := filesharing.GenerateDownloadPath(basepath, fileKey, true) // check if the file exists...if it does then set the path... if _, err := os.Stat(fp); err == nil {