[libgepub/wip/hadess/disable-javascript: 3/4] lib: Remove absolute external resources from gepub




commit d843afde93b8ba7d49e220de304ea32bd7d48750
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Mar 31 13:16:33 2021 +0200

    lib: Remove absolute external resources from gepub
    
    When setting the internal resources paths to use the custom epub scheme,
    remove all the resources with absolute URIs, they might force us to load
    data from external locations.

 libgepub/gepub-utils.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/libgepub/gepub-utils.c b/libgepub/gepub-utils.c
index 2f5d1c2..d4fc8b0 100644
--- a/libgepub/gepub-utils.c
+++ b/libgepub/gepub-utils.c
@@ -62,6 +62,9 @@ set_epub_uri (xmlNode *node,
                 SoupURI *uri = soup_uri_new_with_base (baseURI, (const char *) text);
                 gchar *value = soup_uri_to_string (uri, FALSE);
 
+                if (!g_str_equal (soup_uri_get_scheme (uri), "epub"))
+                    g_clear_pointer (&value, g_free);
+
                 xmlSetProp (cur_node, BAD_CAST (attrname), BAD_CAST (value));
 
                 soup_uri_free (uri);


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