Unverified Commit 5166de0e authored by Erik Reider's avatar Erik Reider Committed by GitHub

Always unescape image and app icon paths (#518)

parent 8ed5a805
...@@ -29,7 +29,7 @@ namespace SwayNotificationCenter { ...@@ -29,7 +29,7 @@ namespace SwayNotificationCenter {
if (is_uri) uri = uri.slice (URI_PREFIX.length, uri.length); if (is_uri) uri = uri.slice (URI_PREFIX.length, uri.length);
var pixbuf = new Gdk.Pixbuf.from_file_at_scale ( var pixbuf = new Gdk.Pixbuf.from_file_at_scale (
uri, Uri.unescape_string (uri),
icon_size * img.scale_factor, icon_size * img.scale_factor,
icon_size * img.scale_factor, icon_size * img.scale_factor,
true); true);
......
...@@ -133,7 +133,7 @@ namespace SwayNotificationCenter { ...@@ -133,7 +133,7 @@ namespace SwayNotificationCenter {
this.applied_id = applied_id; this.applied_id = applied_id;
this.app_name = app_name; this.app_name = app_name;
this.replaces_id = replaces_id; this.replaces_id = replaces_id;
this.app_icon = app_icon; this.app_icon = Uri.unescape_string (app_icon);
this.summary = summary; this.summary = summary;
this.body = body; this.body = body;
this.hints = hints; this.hints = hints;
...@@ -237,7 +237,7 @@ namespace SwayNotificationCenter { ...@@ -237,7 +237,7 @@ namespace SwayNotificationCenter {
case "image-path": case "image-path":
case "image_path": case "image_path":
if (hint_value.is_of_type (VariantType.STRING)) { if (hint_value.is_of_type (VariantType.STRING)) {
image_path = hint_value.get_string (); image_path = Uri.unescape_string (hint_value.get_string ());
} }
break; break;
case "desktop-entry": case "desktop-entry":
......
...@@ -693,8 +693,7 @@ namespace SwayNotificationCenter { ...@@ -693,8 +693,7 @@ namespace SwayNotificationCenter {
img_app_icon.set_pixel_size (app_icon_size); img_app_icon.set_pixel_size (app_icon_size);
bool img_path_is_theme_icon = false; bool img_path_is_theme_icon = false;
bool img_path_exists = File.new_for_uri ( bool img_path_exists = File.new_for_uri (param.image_path ?? "").query_exists ();
param.image_path ?? "").query_exists ();
if (param.image_path != null && !img_path_exists) { if (param.image_path != null && !img_path_exists) {
// Check if it's not a URI // Check if it's not a URI
img_path_exists = File.new_for_path ( img_path_exists = File.new_for_path (
...@@ -710,11 +709,10 @@ namespace SwayNotificationCenter { ...@@ -710,11 +709,10 @@ namespace SwayNotificationCenter {
img_path_is_theme_icon = img_path_exists; img_path_is_theme_icon = img_path_exists;
} }
} }
var app_icon_exists = File.new_for_uri (app_icon_uri ?? "").query_exists (); bool app_icon_exists = File.new_for_uri (app_icon_uri ?? "").query_exists ();
if (app_icon_uri != null && !img_path_exists) { if (app_icon_uri != null && !app_icon_exists) {
// Check if it's not a URI // Check if it's not a URI
app_icon_exists = File.new_for_path ( app_icon_exists = File.new_for_path (app_icon_uri ?? "").query_exists ();
app_icon_uri ?? "").query_exists ();
} }
// Get the image CSS corner radius in pixels // Get the image CSS corner radius in pixels
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment