fixup filekey.complete checks to check the actual value instead of just existence
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
50b7a43466
commit
db8e43cb05
2
lib.go
2
lib.go
|
@ -775,7 +775,7 @@ func c_CheckDownloadStatus(profilePtr *C.char, profileLen C.int, fileKeyPtr *C.c
|
||||||
func CheckDownloadStatus(profileOnion, fileKey string) {
|
func CheckDownloadStatus(profileOnion, fileKey string) {
|
||||||
profile := application.GetPeer(profileOnion)
|
profile := application.GetPeer(profileOnion)
|
||||||
path, _ := profile.GetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.path", fileKey))
|
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{
|
eventHandler.Push(event.NewEvent(event.FileDownloaded, map[event.Field]string{
|
||||||
ProfileOnion: profileOnion,
|
ProfileOnion: profileOnion,
|
||||||
event.FileKey: fileKey,
|
event.FileKey: fileKey,
|
||||||
|
|
|
@ -260,7 +260,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
||||||
func GetProfileImage(profile peer.CwtchPeer, conversationInfo *model.Conversation, basepath string) 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)))
|
fileKey, err := profile.GetConversationAttribute(conversationInfo.ID, attr.PublicScope.ConstructScopedZonedPath(attr.ProfileZone.ConstructZonedPath(constants.CustomProfileImageKey)))
|
||||||
if err == nil {
|
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)
|
fp, _ := filesharing.GenerateDownloadPath(basepath, fileKey, true)
|
||||||
// check if the file exists...if it does then set the path...
|
// check if the file exists...if it does then set the path...
|
||||||
if _, err := os.Stat(fp); err == nil {
|
if _, err := os.Stat(fp); err == nil {
|
||||||
|
|
Reference in New Issue