Escape ampersands when sending toots
This commit is contained in:
parent
178f869dbc
commit
5aaa26c484
|
@ -174,15 +174,14 @@ public class Tootle.PostDialog : Gtk.Dialog {
|
|||
}
|
||||
|
||||
public void publish_post () {
|
||||
var to_escape = ";";
|
||||
var pars = "?status=%s&visibility=%s".printf (Soup.URI.encode (text.buffer.text, to_escape), visibility_opt.to_string ());
|
||||
var pars = "?status=%s&visibility=%s".printf (Utils.encode (text.buffer.text), visibility_opt.to_string ());
|
||||
pars += attachments.get_uri_array ();
|
||||
if (in_reply_to != null)
|
||||
pars += "&in_reply_to_id=%s".printf (in_reply_to.id.to_string ());
|
||||
|
||||
if (spoiler.active) {
|
||||
pars += "&sensitive=true";
|
||||
pars += "&spoiler_text=" + Soup.URI.encode (spoiler_text.buffer.text, to_escape);
|
||||
pars += "&spoiler_text=" + Utils.encode (spoiler_text.buffer.text);
|
||||
}
|
||||
|
||||
var url = "%s/api/v1/statuses%s".printf (Tootle.accounts.formal.instance, pars);
|
||||
|
|
|
@ -31,6 +31,11 @@ public class Tootle.Utils{
|
|||
.replace ("&", "&")
|
||||
.replace ("'", "'");
|
||||
}
|
||||
|
||||
public static string encode (string content) {
|
||||
var to_escape = ";&";
|
||||
return Soup.URI.encode (content, to_escape);
|
||||
}
|
||||
|
||||
public static void copy (string str) {
|
||||
var display = Tootle.window.get_display ();
|
||||
|
|
Loading…
Reference in New Issue