From 5aeca580f43c5866794a630e35fa18dbfeefaa01 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 26 Oct 2019 12:47:03 +0100 Subject: save complete: Change de-duplication to compare URLs, rather than contents. We seem to have more than one content for the same resource. For example: * save `` as img-test.html * run `rm -rf test-save && make && ./nsgtk img-test.html` * ctrl+s * save as "test-save" in the current netsurf dir. * run `md5sum test-save/*` before and after this commit. The de-duplication works with URLs, where it wasn't working with hlcache_handles or contents. --- desktop/save_complete.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/desktop/save_complete.c b/desktop/save_complete.c index d7a02ae2f..b54e7f31f 100644 --- a/desktop/save_complete.c +++ b/desktop/save_complete.c @@ -370,8 +370,10 @@ save_complete_save_stylesheet(save_complete_ctx *ctx, hlcache_handle *css) char filename[32]; bool result; - if (save_complete_ctx_has_content(ctx, css)) + if (save_complete_ctx_find_content(ctx, + hlcache_handle_get_url(css)) != NULL) { return true; + } if (save_complete_ctx_add_content(ctx, css) == false) { guit->misc->warning("NoMemory", 0); @@ -473,8 +475,10 @@ save_complete_save_html_object(save_complete_ctx *ctx, hlcache_handle *obj) if (obj_data == NULL) return true; - if (save_complete_ctx_has_content(ctx, obj)) + if (save_complete_ctx_find_content(ctx, + hlcache_handle_get_url(obj)) != NULL) { return true; + } if (save_complete_ctx_add_content(ctx, obj) == false) { guit->misc->warning("NoMemory", 0); -- cgit v1.2.3