From 9e5ec0c9dfca3f0ec8d6ae7b36fb4039cfe9d78c Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 29 Mar 2021 02:24:43 +0900 Subject: [PATCH] Calculate media URI properly even when MEDIA_UPLOAD_DIRECTORY configured --- plume-models/src/medias.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plume-models/src/medias.rs b/plume-models/src/medias.rs index db5a86ab..13a212b6 100644 --- a/plume-models/src/medias.rs +++ b/plume-models/src/medias.rs @@ -156,7 +156,11 @@ impl Media { if self.is_remote { Ok(self.remote_url.clone().unwrap_or_default()) } else { - let file_path = self.file_path.replace(path::MAIN_SEPARATOR, "/"); + let file_path = self.file_path.replace(path::MAIN_SEPARATOR, "/").replacen( + &CONFIG.media_directory, + "static/media", + 1, + ); // "static/media" from plume::routs::plume_media_files() Ok(ap_url(&format!( "{}/{}", Instance::get_local()?.public_domain,