Compare commits

...

3 Commits

Author SHA1 Message Date
httpjamesm 56c9e4b196 version 1.10.1 2023-09-28 13:54:28 -04:00
httpjamesm 16828585ac feat: allow stackoverflow.com/q/ in posthome (#66) 2023-09-28 13:54:13 -04:00
Bnyro cf89be2a48 fix: redirect shortened 'a' URLs (#65) 2023-09-28 13:26:34 -04:00
3 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
package config
var Version = "1.10.0"
var Version = "1.10.1"
+1
View File
@@ -51,6 +51,7 @@ func main() {
r.POST("/", routes.PostHome)
r.GET("/a/:id", routes.RedirectShortenedOverflowURL)
r.GET("/q/:id", routes.RedirectShortenedOverflowURL)
r.GET("/questions/:id", func(c *gin.Context) {
// redirect user to the question with the title
+1 -1
View File
@@ -40,7 +40,7 @@ func PostHome(c *gin.Context) {
// validate URL
isStackOverflow := strings.HasPrefix(soLink, "https://stackoverflow.com/questions/")
isShortenedStackOverflow := strings.HasPrefix(soLink, "https://stackoverflow.com/a/")
isShortenedStackOverflow := strings.HasPrefix(soLink, "https://stackoverflow.com/a/") || strings.HasPrefix(soLink, "https://stackoverflow.com/q/")
isStackExchange := stackExchangeRegex.MatchString(soLink)
if !isStackExchange && !isStackOverflow && !isShortenedStackOverflow {
c.HTML(400, "home.html", gin.H{