Skip to content

Commit 5166de0

Browse files
authored
Always unescape image and app icon paths (ErikReider#518)
1 parent 8ed5a80 commit 5166de0

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/functions.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace SwayNotificationCenter {
2929
if (is_uri) uri = uri.slice (URI_PREFIX.length, uri.length);
3030

3131
var pixbuf = new Gdk.Pixbuf.from_file_at_scale (
32-
uri,
32+
Uri.unescape_string (uri),
3333
icon_size * img.scale_factor,
3434
icon_size * img.scale_factor,
3535
true);

src/notiModel/notiModel.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ namespace SwayNotificationCenter {
133133
this.applied_id = applied_id;
134134
this.app_name = app_name;
135135
this.replaces_id = replaces_id;
136-
this.app_icon = app_icon;
136+
this.app_icon = Uri.unescape_string (app_icon);
137137
this.summary = summary;
138138
this.body = body;
139139
this.hints = hints;
@@ -237,7 +237,7 @@ namespace SwayNotificationCenter {
237237
case "image-path":
238238
case "image_path":
239239
if (hint_value.is_of_type (VariantType.STRING)) {
240-
image_path = hint_value.get_string ();
240+
image_path = Uri.unescape_string (hint_value.get_string ());
241241
}
242242
break;
243243
case "desktop-entry":

src/notification/notification.vala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,7 @@ namespace SwayNotificationCenter {
693693
img_app_icon.set_pixel_size (app_icon_size);
694694

695695
bool img_path_is_theme_icon = false;
696-
bool img_path_exists = File.new_for_uri (
697-
param.image_path ?? "").query_exists ();
696+
bool img_path_exists = File.new_for_uri (param.image_path ?? "").query_exists ();
698697
if (param.image_path != null && !img_path_exists) {
699698
// Check if it's not a URI
700699
img_path_exists = File.new_for_path (
@@ -710,11 +709,10 @@ namespace SwayNotificationCenter {
710709
img_path_is_theme_icon = img_path_exists;
711710
}
712711
}
713-
var app_icon_exists = File.new_for_uri (app_icon_uri ?? "").query_exists ();
714-
if (app_icon_uri != null && !img_path_exists) {
712+
bool app_icon_exists = File.new_for_uri (app_icon_uri ?? "").query_exists ();
713+
if (app_icon_uri != null && !app_icon_exists) {
715714
// Check if it's not a URI
716-
app_icon_exists = File.new_for_path (
717-
app_icon_uri ?? "").query_exists ();
715+
app_icon_exists = File.new_for_path (app_icon_uri ?? "").query_exists ();
718716
}
719717

720718
// Get the image CSS corner radius in pixels

0 commit comments

Comments
 (0)