dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 1cd349beccd0cdb41fc333f5ee0ee4e1b4553bfd
parent d9fadd28d0349d22c38ff8691fd6d7065fcd5622
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Tue, 15 Nov 2022 22:40:27 -0500

fix regexes

Diffstat:
Mpkg/web/handlers/api/v1/handlers.go | 4++--
Mpkg/web/handlers/api/v1/topBarHandler.go | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkg/web/handlers/api/v1/handlers.go b/pkg/web/handlers/api/v1/handlers.go @@ -29,8 +29,8 @@ var roomName = `\w{3,50}` var chatTs = `\d{2}:\d{2}:\d{2}` var optAtGUser = `@?(` + usernameF + `)` // Optional @, Grouped, Username var optAtGUserOr0 = `@?(` + userOr0 + `)` // Optional @, Grouped, Username or 0 -var onionV2Rgx = regexp.MustCompile(`[a-z2-7]{16}.onion`) -var onionV3Rgx = regexp.MustCompile(`[a-z2-7]{56}.onion`) +var onionV2Rgx = regexp.MustCompile(`[a-z2-7]{16}\.onion`) +var onionV3Rgx = regexp.MustCompile(`[a-z2-7]{56}\.onion`) var deleteMsgRgx = regexp.MustCompile(`^/d (\d{2}:\d{2}:\d{2})(?:\s` + optAtGUserOr0 + `)?$`) var ignoreRgx = regexp.MustCompile(`^/(?:ignore|i) ` + optAtGUser) var pmToggleWhitelistUserRgx = regexp.MustCompile(`^/pmw ` + optAtGUser) diff --git a/pkg/web/handlers/api/v1/topBarHandler.go b/pkg/web/handlers/api/v1/topBarHandler.go @@ -801,7 +801,7 @@ func styleQuote(origHtml string, quoted *database.ChatMessage) (html string) { return html } -var noSchemeOnionLinkRgx = regexp.MustCompile(`\s[a-z2-7]{56}.onion`) +var noSchemeOnionLinkRgx = regexp.MustCompile(`\s[a-z2-7]{56}\.onion`) // Fix up onion links that are missing the http scheme. This often happen when copy/pasting a link. func convertLinksWithoutScheme(in string) string {