mirror of
https://github.com/httpjamesm/AnonymousOverflow.git
synced 2024-12-06 19:16:43 +01:00
fix: replace stackoverflow.com links with path
This commit is contained in:
+2
-2
@@ -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)
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ var sampleInput = `<div class="d-flex fd-column fw-nowrap">
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex--item mb0 mt4">
|
||||
<a href="/questions/27221504/how-can-you-make-a-safe-static-singleton-in-rust" dir="ltr">How can you make a safe static singleton in Rust?</a>
|
||||
<a href="https://stackoverflow.com/questions/27221504/how-can-you-make-a-safe-static-singleton-in-rust" dir="ltr">How can you make a safe static singleton in Rust?</a>
|
||||
<span class="question-originals-answer-count">
|
||||
(5 answers)
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user