store securefiles in messages and not filenames
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
09892709ec
commit
99a9aa14af
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user