From ee9b5bac0a0e8a851dc487d0107161eec1c41d70 Mon Sep 17 00:00:00 2001 From: Eugene Medvedev Date: Tue, 28 May 2019 18:11:28 +0500 Subject: [PATCH] Add parse fragment URL --- sicra/crawler.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sicra/crawler.go b/sicra/crawler.go index c421032..ff51e88 100644 --- a/sicra/crawler.go +++ b/sicra/crawler.go @@ -125,7 +125,13 @@ func urlEscape(refurl string) string { host := parseURL.Host pathuri := parseURL.EscapedPath() query := url.QueryEscape(parseURL.RawQuery) - - escapeURL := (scheme + "://" + host + pathuri + "?" + query) + if query != "" { + query = "?" + query + } + fragment := url.QueryEscape(parseURL.Fragment) + if fragment != "" { + fragment = "#" + fragment + } + escapeURL := (scheme + "://" + host + pathuri + query + fragment) return escapeURL }