-
Notifications
You must be signed in to change notification settings - Fork 117
Open
Description
I was getting signature failures when a query parameter had a properly escaped space. I replaced the existing escape method with url.QueryEscape and fixed. Patch below.
diff --git a/oauth.go b/oauth.go
index d8e0ea2..07cccac 100644
--- a/oauth.go
+++ b/oauth.go
@@ -957,23 +957,7 @@ func (s *RSASigner) SignatureMethod() string {
}
func escape(s string) string {
- t := make([]byte, 0, 3*len(s))
- for i := 0; i < len(s); i++ {
- c := s[i]
- if isEscapable(c) {
- t = append(t, '%')
- t = append(t, "0123456789ABCDEF"[c>>4])
- t = append(t, "0123456789ABCDEF"[c&15])
- } else {
- t = append(t, s[i])
- }
- }
- return string(t)
-}
-
-func isEscapable(b byte) bool {
- return !('A' <= b && b <= 'Z' || 'a' <= b && b <= 'z' || '0' <= b && b <= '9' || b == '-' || b == '.' || b == '_' || b == '~')
-
+ return url.QueryEscape(s)
}
Metadata
Metadata
Assignees
Labels
No labels