feat: allow stackoverflow.com/q/ in posthome

This commit is contained in:
httpjamesm 2023-09-28 13:53:34 -04:00
parent dcf0805334
commit e3d60d4d3e
No known key found for this signature in database

View file

@ -40,7 +40,7 @@ func PostHome(c *gin.Context) {
// validate URL // validate URL
isStackOverflow := strings.HasPrefix(soLink, "https://stackoverflow.com/questions/") 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) isStackExchange := stackExchangeRegex.MatchString(soLink)
if !isStackExchange && !isStackOverflow && !isShortenedStackOverflow { if !isStackExchange && !isStackOverflow && !isShortenedStackOverflow {
c.HTML(400, "home.html", gin.H{ c.HTML(400, "home.html", gin.H{