Skip to content

Commit

Permalink
fixed?
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Jan 13, 2025
1 parent a45fcc5 commit 4b3f2f5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions api_tests/src/image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ test.only("Purge user, uploaded image removed", async () => {
};
const delete_ = await alphaImage.purgePerson(purgeForm);
expect(delete_.success).toBe(true);
console.log(upload.image_url + " should be purged");

// ensure that image is deleted
const response2 = await fetch(upload.image_url ?? "");
Expand Down
10 changes: 10 additions & 0 deletions crates/api_common/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,11 @@ pub async fn purge_image_from_pictrs(image_url: &Url, context: &LemmyContext) ->
.next_back()
.ok_or(LemmyErrorType::ImageUrlMissingLastPathSegment)?;

// Delete db row if any (old Lemmy versions didnt generate this).
LocalImage::delete_by_alias(&mut context.pool(), &alias)
.await
.ok();

let pictrs_config = context.settings().pictrs()?;
let purge_url = format!("{}internal/purge?alias={}", pictrs_config.url, alias);

Expand Down Expand Up @@ -355,6 +360,11 @@ pub async fn delete_image_from_pictrs(
delete_token: &str,
context: &LemmyContext,
) -> LemmyResult<()> {
// Delete db row if any (old Lemmy versions didnt generate this).
LocalImage::delete_by_alias(&mut context.pool(), &alias)
.await
.ok();

let pictrs_config = context.settings().pictrs()?;
let url = format!(
"{}image/delete/{}/{}",
Expand Down

0 comments on commit 4b3f2f5

Please sign in to comment.