Skip to content

Commit

Permalink
Merge pull request #115 from projectdiscovery/bugfix-url-with-port
Browse files Browse the repository at this point in the history
Encoding semicolon on windows
  • Loading branch information
Mzack9999 authored Mar 29, 2023
2 parents fc09120 + 5f6dd3c commit 02d9b82
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion url/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

errorutil "github.com/projectdiscovery/utils/errors"
osutils "github.com/projectdiscovery/utils/os"
stringsutil "github.com/projectdiscovery/utils/strings"
)

Expand Down Expand Up @@ -119,7 +120,11 @@ func (u *URL) String() string {
// EscapedString returns a string that can be used as filename (i.e stripped of / and params etc)
func (u *URL) EscapedString() string {
var buff bytes.Buffer
buff.WriteString(u.Host)
host := u.Host
if osutils.IsWindows() {
host = strings.ReplaceAll(host, ":", "_")
}
buff.WriteString(host)
if u.Path != "" && u.Path != "/" {
buff.WriteString("_" + strings.ReplaceAll(u.Path, "/", "_"))
}
Expand Down

0 comments on commit 02d9b82

Please sign in to comment.