mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-08-25 04:03:19 +00:00
Get host from client and put it in the attachments URL (only the web vault works without indicating the host in the URL)
This commit is contained in:
parent
912901780e
commit
47a116bbee
5 changed files with 19 additions and 15 deletions
|
@ -29,10 +29,10 @@ impl Attachment {
|
|||
format!("{}/{}/{}", CONFIG.attachments_folder, self.cipher_uuid, self.id)
|
||||
}
|
||||
|
||||
pub fn to_json(&self) -> JsonValue {
|
||||
pub fn to_json(&self, host: &str) -> JsonValue {
|
||||
use util::get_display_size;
|
||||
|
||||
let web_path = format!("/attachments/{}/{}", self.cipher_uuid, self.id);
|
||||
let web_path = format!("{}/attachments/{}/{}", host, self.cipher_uuid, self.id);
|
||||
let display_size = get_display_size(self.file_size);
|
||||
|
||||
json!({
|
||||
|
|
|
@ -57,7 +57,7 @@ use db::schema::ciphers;
|
|||
|
||||
/// Database methods
|
||||
impl Cipher {
|
||||
pub fn to_json(&self, conn: &DbConn) -> JsonValue {
|
||||
pub fn to_json(&self, host: &str, conn: &DbConn) -> JsonValue {
|
||||
use serde_json;
|
||||
use util::format_date;
|
||||
use super::Attachment;
|
||||
|
@ -65,7 +65,7 @@ impl Cipher {
|
|||
let data_json: JsonValue = serde_json::from_str(&self.data).unwrap();
|
||||
|
||||
let attachments = Attachment::find_by_cipher(&self.uuid, conn);
|
||||
let attachments_json: Vec<JsonValue> = attachments.iter().map(|c| c.to_json()).collect();
|
||||
let attachments_json: Vec<JsonValue> = attachments.iter().map(|c| c.to_json(host)).collect();
|
||||
|
||||
json!({
|
||||
"Id": self.uuid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue