use https as default scheme for links
This commit is contained in:
parent
a5616ade77
commit
6f449301ff
13
main.go
13
main.go
@ -159,6 +159,19 @@ func saveChanges(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
for _, bookmark := range sessionData.Bookmarks {
|
||||
uri, err := url.Parse(bookmark.Link)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if uri.Scheme == "" {
|
||||
uri.Scheme = "https"
|
||||
}
|
||||
bookmark.Link = uri.String()
|
||||
}
|
||||
|
||||
Reorder(sessionData.Bookmarks)
|
||||
if err := DeleteBookmarksBySessionID(session.ID); err != nil {
|
||||
fmt.Println(err)
|
||||
|
Loading…
Reference in New Issue
Block a user