Remove http:// and https://

Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
Odyssey 2022-11-29 21:03:05 +01:00
parent 7dbaef6386
commit 8978817634

View File

@ -79,6 +79,21 @@ func HandleUser(c *fiber.Ctx) error {
// Trust Nobody
readmeOutput := UGCPolicy().SanitizeBytes(mightBeUnsafe)
var link string
if user.Get("blog").String() == "" {
link = ""
} else {
link = user.Get("blog").String()
if strings.HasPrefix(link, "https://") {
link = strings.TrimPrefix(link, "https://")
} else if strings.HasPrefix(link, "http://") {
link = strings.TrimPrefix(link, "http://")
} else {
log.Println("Has no prefix")
}
}
userArray = append(userArray, User{
Login: user.Get("login").String(),
Name: user.Get("name").String(),
@ -87,7 +102,7 @@ func HandleUser(c *fiber.Ctx) error {
Location: user.Get("location").String(),
Following: user.Get("following").Int(),
Followers: user.Get("followers").Int(),
Link: user.Get("blog").String(),
Link: link,
Company: user.Get("company").String(),
Type: user.Get("type").String(),
EwTwitter: user.Get("twitter_username").String(),