Merge pull request 'Calculate media URI properly even when MEDIA_UPLOAD_DIRECTORY configured' (#916) from media-directory into main

Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/916
This commit is contained in:
KitaitiMakoto 2021-03-28 18:18:14 +00:00
commit dd932e1f15
2 changed files with 7 additions and 2 deletions

View File

@ -26,7 +26,8 @@
- Menu animation not opening on iOS (#876, #897)
- Make actors subscribe to channel once (#913)
- Upsert posts and media instead of trying to insert and fail (#912)
- Update post's ActivityPub id when published by update
- Update post's ActivityPub id when published by update (#915)
- Calculate media URI properly even when MEDIA_UPLOAD_DIRECTORY configured (#916)
## [[0.6.0]] - 2020-12-29

View File

@ -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,