link rewrite logic fix

This commit is contained in:
Ryan Stafford 2023-07-04 01:11:50 -04:00 committed by GitHub
parent a850af0526
commit 8668878548
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,7 +118,7 @@ var funcMap = template.FuncMap{
}
converted := buf.String()
converted = strings.Replace(converted, `<img `, `<img loading="lazy" `, -1)
if os.Getenv("LEMMY_DOMAIN") != "" {
if os.Getenv("LEMMY_DOMAIN") == "" {
re := regexp.MustCompile(`href="https:\/\/([a-zA-Z0-9\.]+\/(c\/[a-zA-Z0-9]+|(post|comment)\/\d+))`)
converted = re.ReplaceAllString(converted, `href="/$1`)
}