Remove http:// and https://
Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
parent
7dbaef6386
commit
8978817634
@ -79,6 +79,21 @@ func HandleUser(c *fiber.Ctx) error {
|
|||||||
// Trust Nobody
|
// Trust Nobody
|
||||||
readmeOutput := UGCPolicy().SanitizeBytes(mightBeUnsafe)
|
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{
|
userArray = append(userArray, User{
|
||||||
Login: user.Get("login").String(),
|
Login: user.Get("login").String(),
|
||||||
Name: user.Get("name").String(),
|
Name: user.Get("name").String(),
|
||||||
@ -87,7 +102,7 @@ func HandleUser(c *fiber.Ctx) error {
|
|||||||
Location: user.Get("location").String(),
|
Location: user.Get("location").String(),
|
||||||
Following: user.Get("following").Int(),
|
Following: user.Get("following").Int(),
|
||||||
Followers: user.Get("followers").Int(),
|
Followers: user.Get("followers").Int(),
|
||||||
Link: user.Get("blog").String(),
|
Link: link,
|
||||||
Company: user.Get("company").String(),
|
Company: user.Get("company").String(),
|
||||||
Type: user.Get("type").String(),
|
Type: user.Get("type").String(),
|
||||||
EwTwitter: user.Get("twitter_username").String(),
|
EwTwitter: user.Get("twitter_username").String(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user