[epiphany] Allow pdfjs only for GET requests



commit 83d5af70f431f0540811e4adcb19e666290413e8
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Tue Aug 10 15:51:39 2021 +0200

    Allow pdfjs only for GET requests
    
    Use internal pdf viewer only for GET. In case it is a POST request download it.
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1505
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1001>

 embed/ephy-web-view.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 6fed0f3f0..6265362de 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -905,6 +905,8 @@ decide_policy_cb (WebKitWebView            *web_view,
 
   /* If it's not the main resource, we don't need to set the document type. */
   if (is_main_resource) {
+    const char *method = webkit_uri_request_get_http_method (request);
+
     type = EPHY_WEB_VIEW_DOCUMENT_OTHER;
     if (strcmp (mime_type, "text/html") == 0 || strcmp (mime_type, "text/plain") == 0) {
       type = EPHY_WEB_VIEW_DOCUMENT_HTML;
@@ -912,7 +914,7 @@ decide_policy_cb (WebKitWebView            *web_view,
       type = EPHY_WEB_VIEW_DOCUMENT_XML;
     } else if (strncmp (mime_type, "image/", 6) == 0) {
       type = EPHY_WEB_VIEW_DOCUMENT_IMAGE;
-    } else if (strcmp (mime_type, "application/pdf") == 0) {
+    } else if (strcmp (mime_type, "application/pdf") == 0 && strcmp (method, "GET") == 0) {
       g_autofree char *pdf_uri = NULL;
 
       /* FIXME: figure out how to make PDFs work in iframes. */


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