From cb9a3aa7b9880e56cf4b474df10ad80650bf1e96 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 3 Jun 2024 17:48:15 -0400 Subject: [PATCH] Update crates/api_common/src/request.rs Co-authored-by: dullbananas --- crates/api_common/src/request.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index 6f1a86e0a..9bfb97b72 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -345,8 +345,9 @@ pub async fn replace_image( context: &Data, ) -> LemmyResult<()> { if let (Some(new_image), Some(old_image)) = (new_image, old_image) { - // Note: Oftentimes front ends will include the current image in the form, - // so only delete if the urls are different. + // Note: Oftentimes front ends will include the current image in the form. + // In this case, deleting `old_image` would also be deletion of `new_image`, + // so the deletion must be skipped for the image to be kept. if new_image != old_image.as_str() { // Ignore errors because image may be stored externally. let image = LocalImage::delete_by_url(&mut context.pool(), old_image)