diff --git a/link.go b/link.go index 765e48f..7b747d7 100644 --- a/link.go +++ b/link.go @@ -71,9 +71,13 @@ func createLinkController(a *App) gin.HandlerFunc { c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{ "errorMessage": fmt.Sprintf("Unable to create link, error: %s", err), }) + sanitizedLinkName := strings.ReplaceAll(link.Name, "\n", "") + sanitizedLinkName = strings.ReplaceAll(sanitizedLinkName, "\r", "") + sanitizedLinkRedirect := strings.ReplaceAll(link.Redirect, "\n", "") + sanitizedLinkRedirect = strings.ReplaceAll(sanitizedLinkRedirect, "\r", "") log.WithFields(log.Fields{ - "name": link.Name, - "redirect": link.Redirect, + "name": sanitizedLinkName, + "redirect": sanitizedLinkRedirect, }).Errorf("unable to create link, error: %s", err) return }