From 5ec826a160b4ceed26fb29303611154e16f73d6a Mon Sep 17 00:00:00 2001 From: httpjamesm Date: Sat, 9 Mar 2024 11:55:02 -0500 Subject: [PATCH] fix: replace stackoverflow.com links with path --- src/utils/links.go | 4 ++-- src/utils/links_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/links.go b/src/utils/links.go index deeb81c..56ad79a 100644 --- a/src/utils/links.go +++ b/src/utils/links.go @@ -35,10 +35,10 @@ func ReplaceStackOverflowLinks(html string) string { if len(parts) > 2 { // Prepend the subdomain to the path url.Path = "/exchange/" + parts[0] + url.Path - - newUrl = url.Path + url.RawQuery + url.Fragment } + newUrl = url.Path + url.RawQuery + url.Fragment + // Replace the href attribute value in the anchor tag return strings.Replace(match, hrefMatch[1], newUrl, 1) }) diff --git a/src/utils/links_test.go b/src/utils/links_test.go index 439970c..5279fe8 100644 --- a/src/utils/links_test.go +++ b/src/utils/links_test.go @@ -25,7 +25,7 @@ var sampleInput = `
- How can you make a safe static singleton in Rust? + How can you make a safe static singleton in Rust? (5 answers)