diff --git a/main.go b/main.go index 0d38df3..b679591 100644 --- a/main.go +++ b/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)