[epiphany] Check for anchors in ephy_embed_utils_address_is_existing_absolute_filename ()



commit bffb1a92951371acc02361de6016ba6b567e8b4d
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Wed Nov 13 18:29:08 2019 +0100

    Check for anchors in ephy_embed_utils_address_is_existing_absolute_filename ()
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/550

 embed/ephy-embed-utils.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 433f70ede..7e5874196 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -142,8 +142,19 @@ ephy_embed_utils_address_has_web_scheme (const char *address)
 gboolean
 ephy_embed_utils_address_is_existing_absolute_filename (const char *address)
 {
-  return g_path_is_absolute (address) &&
-         g_file_test (address, G_FILE_TEST_EXISTS);
+  g_autofree char *real_address = NULL;
+
+  if (!strchr (address, '#')) {
+    real_address = g_strdup (address);
+  } else {
+    gint pos;
+
+    pos = g_strstr_len (address, -1, "#") - address;
+    real_address = g_strndup (address, pos);
+  }
+
+  return g_path_is_absolute (real_address) &&
+         g_file_test (real_address, G_FILE_TEST_EXISTS);
 }
 
 static gboolean


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