From 7532d36e7e61ff60395f1819bd9010d7b723074e Mon Sep 17 00:00:00 2001 From: Radhi Fadlillah Date: Sat, 26 May 2018 21:11:02 +0700 Subject: [PATCH] Clear fragment from URL --- cmd/cmd-handler.go | 9 ++++++--- cmd/serve/web-handler-api.go | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/cmd-handler.go b/cmd/cmd-handler.go index 97053eb..cf7cb11 100644 --- a/cmd/cmd-handler.go +++ b/cmd/cmd-handler.go @@ -43,7 +43,8 @@ func (h *cmdHandler) addBookmark(cmd *cobra.Command, args []string) { return } - // Clear UTM parameters from URL + // Clear fragment and UTM parameters from URL + parsedURL.Fragment = "" clearUTMParams(parsedURL) // Create bookmark item @@ -238,7 +239,8 @@ func (h *cmdHandler) updateBookmarks(cmd *cobra.Command, args []string) { return } - // Clear UTM parameters from URL + // Clear fragment and UTM parameters from URL + parsedURL.Fragment = "" clearUTMParams(parsedURL) url = parsedURL.String() @@ -623,7 +625,8 @@ func (h *cmdHandler) importBookmarks(cmd *cobra.Command, args []string) { continue } - // Clear UTM parameters from URL + // Clear fragment and UTM parameters from URL + parsedURL.Fragment = "" clearUTMParams(parsedURL) book.URL = parsedURL.String() diff --git a/cmd/serve/web-handler-api.go b/cmd/serve/web-handler-api.go index a743ad7..28cece9 100644 --- a/cmd/serve/web-handler-api.go +++ b/cmd/serve/web-handler-api.go @@ -111,7 +111,8 @@ func (h *webHandler) apiInsertBookmark(w http.ResponseWriter, r *http.Request, p panic(fmt.Errorf("URL is not valid")) } - // Clear UTM parameter from URL + // Clear fragment and UTM parameters from URL + parsedURL.Fragment = "" clearUTMParams(parsedURL) book.URL = parsedURL.String()