[evolution] Bug #674466 - Mail's preview panel can show listing of local filesystem root



commit a593d514c872dace24e899c1ccb25955f985cbc4
Author: Dan VrÃtil <dvratil redhat com>
Date:   Fri Apr 27 17:53:42 2012 +0200

    Bug #674466 - Mail's preview panel can show listing of local filesystem root

 mail/e-mail-display.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 0b1c343..1ffeb82 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -384,6 +384,19 @@ mail_display_link_clicked (WebKitWebView *web_view,
 	EMailDisplay *display;
 	const gchar *uri = webkit_network_request_get_uri (request);
 
+	if (g_str_has_prefix (uri, "file://")) {
+		gchar *filename;
+		filename = g_filename_from_uri (uri, NULL, NULL);
+
+		if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
+			webkit_web_policy_decision_ignore (policy_decision);
+			webkit_network_request_set_uri (request, "about:blank");
+			return TRUE;
+		}
+
+		g_free (filename);
+	}
+
 	display = E_MAIL_DISPLAY (web_view);
 	if (display->priv->formatter == NULL)
 		return FALSE;
@@ -448,7 +461,7 @@ mail_display_resource_requested (WebKitWebView *web_view,
 	const gchar *uri = webkit_network_request_get_uri (request);
 
 	if (!formatter) {
-		webkit_network_request_set_uri (request, "invalid://uri");
+		webkit_network_request_set_uri (request, "about:blank");
 		return;
 	}
 
@@ -499,7 +512,7 @@ mail_display_resource_requested (WebKitWebView *web_view,
                  * a native placeholder for it. */
 		if (!stream && !display->priv->force_image_load &&
 		    !em_format_html_can_load_images (display->priv->formatter)) {
-			webkit_network_request_set_uri (request, "invalid://protocol");
+			webkit_network_request_set_uri (request, "about:blank");
 			return;
 		}
 



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