Add securefiles directory for storing encrypted files
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2024-03-31 19:39:50 +02:00
parent aaa4d88a2f
commit 8fca09d853

View File

@ -51,9 +51,16 @@ func StoreMessage(peer *Peer, usermessage *meowlib.UserMessage, filenames []stri
if err != nil { if err != nil {
return err return err
} }
os.WriteFile(hiddenFilename, encData, 0600) if _, err := os.Stat(filepath.Join(cfg.StoragePath, identity.Uuid, "securefiles")); os.IsNotExist(err) {
err = os.MkdirAll(filepath.Join(cfg.StoragePath, identity.Uuid, "securefiles"), 0755)
if err != nil {
return err
}
}
os.WriteFile(filepath.Join(cfg.StoragePath, identity.Uuid, "securefiles", hiddenFilename), encData, 0600)
// replace f.Data by uuid filename // replace f.Data by uuid filename
f.Data = []byte(hiddenFilename) f.Data = []byte(filepath.Join(cfg.StoragePath, identity.Uuid, "securefiles", hiddenFilename))
} }
} }
outbound := true outbound := true