Fix preview URL (fixes libreddit/libreddit/issues/559)

This commit is contained in:
Matthew Esposito 2024-01-02 19:21:24 -05:00
parent 0c79cefed7
commit dea805936c
No known key found for this signature in database

View File

@ -872,7 +872,7 @@ pub fn format_url(url: &str) -> String {
}
static REDDIT_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r#"href="(https|http|)://(www\.|old\.|np\.|amp\.|new\.|)(reddit\.com|redd\.it)/"#).unwrap());
static REDDIT_PREVIEW_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"https?://external-preview\.redd\.it(.*)[^?]").unwrap());
static REDDIT_PREVIEW_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"https?://(external-preview|preview)\.redd\.it(.*)[^?]").unwrap());
// Rewrite Reddit links to Redlib in body of text
pub fn rewrite_urls(input_text: &str) -> String {