[shotwell/wip/libsoup3: 7/10] Fix URL escaping for OAuth1




commit a15983d43acd5010f1f6455b78eafcb653401884
Author: Jens Georg <mail jensge org>
Date:   Sat Jul 9 11:10:18 2022 +0200

    Fix URL escaping for OAuth1

 plugins/common/OAuth1Support.vala                       | 7 +++----
 plugins/common/RESTSupport.vala                         | 2 +-
 plugins/shotwell-publishing-extras/RajcePublishing.vala | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/plugins/common/OAuth1Support.vala b/plugins/common/OAuth1Support.vala
index 195d14ba..e5b77606 100644
--- a/plugins/common/OAuth1Support.vala
+++ b/plugins/common/OAuth1Support.vala
@@ -6,7 +6,6 @@
  */
 
 namespace Publishing.RESTSupport.OAuth1 {
-    internal const string ENCODE_RFC_3986_EXTRA = "!*'();:@&=+$,/?%#[] \\";
 
     public class Session : Publishing.RESTSupport.Session {
         private string? request_phase_token = null;
@@ -81,8 +80,8 @@ namespace Publishing.RESTSupport.OAuth1 {
             }
 
             string signature_base_string = http_method + "&" + GLib.Uri.escape_string(
-                    txn.get_endpoint_url(), ENCODE_RFC_3986_EXTRA) + "&" +
-                GLib.Uri.escape_string (arguments_string, ENCODE_RFC_3986_EXTRA);
+                    txn.get_endpoint_url()) + "&" +
+                GLib.Uri.escape_string (arguments_string);
 
             debug("signature base string = '%s'", signature_base_string);
 
@@ -90,7 +89,7 @@ namespace Publishing.RESTSupport.OAuth1 {
 
             // compute the signature
             string signature = RESTSupport.hmac_sha1(signing_key, signature_base_string);
-            signature = GLib.Uri.escape_string(signature, ENCODE_RFC_3986_EXTRA);
+            signature = GLib.Uri.escape_string(signature);
 
             debug("signature = '%s'", signature);
 
diff --git a/plugins/common/RESTSupport.vala b/plugins/common/RESTSupport.vala
index 1d97078f..93d7d691 100644
--- a/plugins/common/RESTSupport.vala
+++ b/plugins/common/RESTSupport.vala
@@ -183,7 +183,7 @@ public class Argument {
 
     public string to_string (bool escape = false, bool encode = false) {
         return "%s=%s%s%s".printf (this.key, escape ? "\"" : "",
-            encode ? GLib.Uri.escape_string(this.value, OAuth1.ENCODE_RFC_3986_EXTRA) : this.value,
+            encode ? GLib.Uri.escape_string(this.value) : this.value,
             escape ? "\"" : "");
     }
 }
diff --git a/plugins/shotwell-publishing-extras/RajcePublishing.vala 
b/plugins/shotwell-publishing-extras/RajcePublishing.vala
index 32dc6045..dcb0c246 100644
--- a/plugins/shotwell-publishing-extras/RajcePublishing.vala
+++ b/plugins/shotwell-publishing-extras/RajcePublishing.vala
@@ -1363,7 +1363,7 @@ internal class LiveApiRequest
         delete doc;
                if( urlencode )
                {
-               return GLib.Uri.escape_string( xmlstr, "&;" );
+               return GLib.Uri.escape_string( xmlstr );
                }
                return xmlstr;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]