Skip to content

Commit

Permalink
fix: treat path as encoded (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr committed May 15, 2023
1 parent 028b743 commit 7d90f1a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/API/Tag.vala
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ public class Tuba.API.Tag : Entity, Widgetizable {
}

protected void on_activated () {
app.main_window.open_view (new Views.Hashtag (name, following));
app.main_window.open_view (new Views.Hashtag (name, following, Path.get_basename (url)));
}
}
2 changes: 1 addition & 1 deletion src/Services/Network/Request.vala
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public class Tuba.Request : GLib.Object {
} else {
Uri t_uri;
try {
t_uri = Uri.parse (url + parameters, UriFlags.ENCODED_QUERY);
t_uri = Uri.parse (url + parameters, UriFlags.ENCODED_PATH | UriFlags.ENCODED_QUERY);
} catch (GLib.UriError e) {
warning (e.message);
return this;
Expand Down
4 changes: 2 additions & 2 deletions src/Views/Hashtag.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ public class Tuba.Views.Hashtag : Views.Timeline {

bool t_following = false;
string t_tag = "";
public Hashtag (string tag, bool? following = null) {
public Hashtag (string tag, bool? following = null, string? url_basename = null) {
Object (
url: @"/api/v1/timelines/tag/$tag",
url: @"/api/v1/timelines/tag/$(url_basename ?? tag)",
label: "#"+tag
);

Expand Down
6 changes: 3 additions & 3 deletions src/Widgets/RichLabel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public class Tuba.Widgets.RichLabel : Adw.Bin {
}

if ("/tags/" in url) {
var encoded = url.split ("/tags/")[1];
var tag = Uri.unescape_string (encoded);
app.main_window.open_view (new Views.Hashtag (tag ?? encoded, null));
var from_url = url.split ("/tags/")[1];
var decoded = Uri.unescape_string (from_url) ?? from_url;
app.main_window.open_view (new Views.Hashtag (decoded, null));
return true;
}

Expand Down

0 comments on commit 7d90f1a

Please sign in to comment.