-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e61e9a3
commit b66b014
Showing
6 changed files
with
23 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,6 @@ package util | |
import ( | ||
"bytes" | ||
"unicode" | ||
|
||
"github.com/yuin/goldmark/util" | ||
) | ||
|
||
type sanitizedError struct { | ||
|
@@ -33,7 +31,7 @@ var schemeSep = []byte("://") | |
|
||
// SanitizeCredentialURLs remove all credentials in URLs (starting with "scheme://") for the input string: "https://user:[email protected]" => "https://[email protected]" | ||
func SanitizeCredentialURLs(s string) string { | ||
bs := util.StringToReadOnlyBytes(s) | ||
bs := UnsafeStringToBytes(s) | ||
schemeSepPos := bytes.Index(bs, schemeSep) | ||
if schemeSepPos == -1 || bytes.IndexByte(bs[schemeSepPos:], '@') == -1 { | ||
return s // fast return if there is no URL scheme or no userinfo | ||
|
@@ -70,5 +68,5 @@ func SanitizeCredentialURLs(s string) string { | |
schemeSepPos = bytes.Index(bs, schemeSep) | ||
} | ||
out = append(out, bs...) | ||
return util.BytesToReadOnlyString(out) | ||
return UnsafeBytesToString(out) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters