Allow fetching from local url, at fetch redirect test (fixes #4526)

pull/4607/head
Felix Ableitner 2 months ago
parent 705e86eb4c
commit 1192fcc06b

3
Cargo.lock generated

@ -17,8 +17,7 @@ checksum = "8f27d075294830fcab6f66e320dab524bc6d048f4a151698e153205559113772"
[[package]]
name = "activitypub_federation"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a028034c642d3ed16b535f98f48b3df30397833c183d68852d79de16650d5ed5"
source = "git+https://github.com/LemmyNet/activitypub-federation-rust.git?branch=follow-local-redirect#2cd31014b34ca7b0c27c7a921669af0e5511059b"
dependencies = [
"activitystreams-kinds",
"actix-web",

@ -99,7 +99,7 @@ lemmy_db_views = { version = "=0.19.4-beta.2", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.19.4-beta.2", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.19.4-beta.2", path = "./crates/db_views_moderator" }
lemmy_federate = { version = "=0.19.4-beta.2", path = "./crates/federate" }
activitypub_federation = { version = "0.5.2", default-features = false, features = [
activitypub_federation = { git = "https://github.com/LemmyNet/activitypub-federation-rust.git", branch = "follow-local-redirect", default-features = false, features = [
"actix-web",
] }
diesel = "2.1.4"

@ -745,3 +745,26 @@ test("Block post that contains banned URL", async () => {
editSiteForm.blocked_urls = [];
await epsilon.editSite(editSiteForm);
});
test("Fetch post with redirect", async () => {
let alphaPost = await createPost(
alpha,
betaCommunity!.community.id,
);
expect(alphaPost.post_view.post).toBeDefined();
// beta fetches from alpha as usual
let betaPost = await resolvePost(beta, alphaPost.post_view.post);
expect(betaPost.post).toBeDefined();
// gamma fetches from beta, and gets redirected to alpha
let gammaPost = await resolvePost(gamma, betaPost.post!.post);
expect(gammaPost.post).toBeDefined();
// fetch remote object from local url, which redirects to the original url
let form: ResolveObject = {
q: `http://lemmy-gamma:8561/post/${gammaPost.post!.post.id}`
};
let gammaPost2 = await gamma.resolveObject(form);
expect(gammaPost2.post).toBeDefined();
});

Loading…
Cancel
Save