diff --git a/client/messagestorage.go b/client/messagestorage.go index 5c5caba..640f426 100644 --- a/client/messagestorage.go +++ b/client/messagestorage.go @@ -43,6 +43,7 @@ func StoreMessage(peer *Peer, usermessage *meowlib.UserMessage, filenames []stri db, _ := sql.Open("sqlite3", filepath.Join(cfg.StoragePath, identity.Uuid, dbid+GetConfig().DbSuffix)) // Open the created SQLite File defer db.Close() // Detach Files + hiddenFilenames := []string{} if len(usermessage.Files) > 0 { for _, f := range usermessage.Files { hiddenFilename := uuid.NewString() @@ -58,7 +59,7 @@ func StoreMessage(peer *Peer, usermessage *meowlib.UserMessage, filenames []stri } } os.WriteFile(filepath.Join(cfg.StoragePath, identity.Uuid, "securefiles", hiddenFilename), encData, 0600) - + hiddenFilenames = append(hiddenFilenames, filepath.Join(cfg.StoragePath, identity.Uuid, "securefiles", hiddenFilename)) // replace f.Data by uuid filename f.Data = []byte(filepath.Join(cfg.StoragePath, identity.Uuid, "securefiles", hiddenFilename)) } @@ -68,7 +69,7 @@ func StoreMessage(peer *Peer, usermessage *meowlib.UserMessage, filenames []stri outbound = false } // Convert UserMessage to DbMessage - dbm := UserMessageToDbMessage(outbound, usermessage, filenames) + dbm := UserMessageToDbMessage(outbound, usermessage, hiddenFilenames) // Encrypt message out, err := proto.Marshal(dbm) if err != nil {