mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-08 23:57:46 +00:00
Fix backslash url rewriting and add tests for rewrite_urls. (#461)
* Fix backslash url rewriting. Add test for rewrite_urls. Fixes #281. * Update to v0.22.5 Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
This commit is contained in:
parent
ed11135af8
commit
eb6c5e5e1e
5 changed files with 22 additions and 8 deletions
|
@ -102,7 +102,7 @@ async fn parse_post(json: &serde_json::Value) -> Post {
|
|||
let body = if val(post, "removed_by_category") == "moderator" {
|
||||
format!("<div class=\"md\"><p>[removed] — <a href=\"https://www.reveddit.com{}\">view removed post</a></p></div>", permalink)
|
||||
} else {
|
||||
rewrite_urls(&val(post, "selftext_html")).replace("\\", "")
|
||||
rewrite_urls(&val(post, "selftext_html"))
|
||||
};
|
||||
|
||||
// Build a post using data parsed from Reddit post API
|
||||
|
@ -201,7 +201,7 @@ fn parse_comments(json: &serde_json::Value, post_link: &str, post_author: &str,
|
|||
let body = if val(&comment, "author") == "[deleted]" && val(&comment, "body") == "[removed]" {
|
||||
format!("<div class=\"md\"><p>[removed] — <a href=\"https://www.reveddit.com{}{}\">view removed comment</a></p></div>", post_link, id)
|
||||
} else {
|
||||
rewrite_urls(&val(&comment, "body_html")).to_string()
|
||||
rewrite_urls(&val(&comment, "body_html"))
|
||||
};
|
||||
|
||||
let author = Author {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue