From b261f73c49e17452b0e5e5e77b62bae0a62974d1 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Thu, 9 Mar 2023 00:54:59 -0500 Subject: [PATCH] some pleroma frontends apparently use notice urls --- activity.go | 8 ++++---- web.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/activity.go b/activity.go index aefb17f..ba88227 100644 --- a/activity.go +++ b/activity.go @@ -511,7 +511,8 @@ var re_mast0link = regexp.MustCompile(`https://[[:alnum:].]+/users/[[:alnum:]]+/ var re_masto1ink = regexp.MustCompile(`https://[[:alnum:].]+/@[[:alnum:]]+/[[:digit:]]+`) var re_misslink = regexp.MustCompile(`https://[[:alnum:].]+/notes/[[:alnum:]]+`) var re_honklink = regexp.MustCompile(`https://[[:alnum:].]+/u/[[:alnum:]]+/h/[[:alnum:]]+`) -var re_romalink = regexp.MustCompile(`https://[[:alnum:].]+/objects/[[:alnum:]-]+`) +var re_r0malink = regexp.MustCompile(`https://[[:alnum:].]+/objects/[[:alnum:]-]+`) +var re_roma1ink = regexp.MustCompile(`https://[[:alnum:].]+/notice/[[:alnum:]]+`) var re_qtlinks = regexp.MustCompile(`>https://[^\s<]+<`) func qutify(user *WhatAbout, content string) string { @@ -521,11 +522,10 @@ func qutify(user *WhatAbout, content string) string { mlinks := re_qtlinks.FindAllString(malcontent, -1) for _, m := range mlinks { m = m[1 : len(m)-1] - if re_mast0link.MatchString(m) || - re_masto1ink.MatchString(m) || + if re_mast0link.MatchString(m) || re_masto1ink.MatchString(m) || re_misslink.MatchString(m) || re_honklink.MatchString(m) || - re_romalink.MatchString(m) { + re_r0malink.MatchString(m) || re_roma1ink.MatchString(m) { j, err := GetJunk(user.ID, m) if err == nil { q, ok := j.GetString("content") diff --git a/web.go b/web.go index 5b900c0..65e113c 100644 --- a/web.go +++ b/web.go @@ -2113,7 +2113,7 @@ func somedays() string { } func lookatme(ava string) string { - if strings.Contains(ava, serverName + "/" + userSep) { + if strings.Contains(ava, serverName+"/"+userSep) { idx := strings.LastIndexByte(ava, '/') if idx < len(ava) { name := ava[idx+1:]