Skip to content

Commit ee9b5ba

Browse files
author
Eugene Medvedev
committed
Add parse fragment URL
1 parent 344e23d commit ee9b5ba

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sicra/crawler.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,13 @@ func urlEscape(refurl string) string {
125125
host := parseURL.Host
126126
pathuri := parseURL.EscapedPath()
127127
query := url.QueryEscape(parseURL.RawQuery)
128-
129-
escapeURL := (scheme + "://" + host + pathuri + "?" + query)
128+
if query != "" {
129+
query = "?" + query
130+
}
131+
fragment := url.QueryEscape(parseURL.Fragment)
132+
if fragment != "" {
133+
fragment = "#" + fragment
134+
}
135+
escapeURL := (scheme + "://" + host + pathuri + query + fragment)
130136
return escapeURL
131137
}

0 commit comments

Comments
 (0)