Calculate media URI properly even when MEDIA_UPLOAD_DIRECTORY configured

This commit is contained in:
Kitaiti Makoto 2021-03-29 02:24:43 +09:00
parent 112c034e27
commit 9e5ec0c9df

View File

@ -156,7 +156,11 @@ impl Media {
if self.is_remote { if self.is_remote {
Ok(self.remote_url.clone().unwrap_or_default()) Ok(self.remote_url.clone().unwrap_or_default())
} else { } 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!( Ok(ap_url(&format!(
"{}/{}", "{}/{}",
Instance::get_local()?.public_domain, Instance::get_local()?.public_domain,