Fix post url federation #99

Closed
nutomic wants to merge 2 commits from fix-url-federation into main
Owner

First commit is the important one. You could just cherry-pick it for now and ignore the other one.

I also tried to fix image uploads in the federation test setup, but for some reason its not working even though pictrs doesnt log any error. But the file with that name is not in the pictrs folder, so something is going wrong.

pictrs_1            | [2020-09-14T16:30:27Z INFO  pict_rs] Uploaded Screenshot_20200628_014931.png as "U8Vr1hZxeb.png"
pictrs_1            | [2020-09-14T16:30:27Z INFO  actix_web::middleware::logger] 172.20.0.10:43814 "POST /image HTTP/1.1" 201 76 "http://localhost:8540/create_post" "pict-rs-frontend, v0.1.0" 0.041548
lemmy-alpha_1       | [2020-09-14T16:30:27Z ERROR actix_http::response] Internal Server Error: Deserialize(Error("expected value", line: 1, column: 1))
lemmy-alpha_1       | [2020-09-14T16:30:27Z INFO  actix_web::middleware::logger] 172.20.0.14:52018 "POST /pictrs/image HTTP/1.1" 500 57 "http://localhost:8540/create_post" "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0" 0.064493
First commit is the important one. You could just cherry-pick it for now and ignore the other one. I also tried to fix image uploads in the federation test setup, but for some reason its not working even though pictrs doesnt log any error. But the file with that name is not in the pictrs folder, so something is going wrong. ``` pictrs_1 | [2020-09-14T16:30:27Z INFO pict_rs] Uploaded Screenshot_20200628_014931.png as "U8Vr1hZxeb.png" pictrs_1 | [2020-09-14T16:30:27Z INFO actix_web::middleware::logger] 172.20.0.10:43814 "POST /image HTTP/1.1" 201 76 "http://localhost:8540/create_post" "pict-rs-frontend, v0.1.0" 0.041548 lemmy-alpha_1 | [2020-09-14T16:30:27Z ERROR actix_http::response] Internal Server Error: Deserialize(Error("expected value", line: 1, column: 1)) lemmy-alpha_1 | [2020-09-14T16:30:27Z INFO actix_web::middleware::logger] 172.20.0.14:52018 "POST /pictrs/image HTTP/1.1" 500 57 "http://localhost:8540/create_post" "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:76.0) Gecko/20100101 Firefox/76.0" 0.064493 ```
Author
Owner

For community icon/banner federation, add this in Community::to_apub(). Tests were still failing with it so I'm probably missing something.

    if let Some(icon) = &self.icon {
      group.set_icon(Url::parse(icon)?);
    }

    if let Some(banner) = &self.banner {
      group.set_image(Url::parse(banner)?);
    }

Also in apub/community.rs line 375 and 387, the first .context() can be replaced with a simple ? as its a result.

Leaving this here because there are too many diferent branches lol.

For community icon/banner federation, add this in `Community::to_apub()`. Tests were still failing with it so I'm probably missing something. ``` if let Some(icon) = &self.icon { group.set_icon(Url::parse(icon)?); } if let Some(banner) = &self.banner { group.set_image(Url::parse(banner)?); } ``` Also in apub/community.rs line 375 and 387, the first `.context()` can be replaced with a simple `?` as its a result. Leaving this here because there are too many diferent branches lol.
nutomic closed this pull request 2020-09-16 17:34:06 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: LemmyNet/lemmy#99
No description provided.