diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2019-10-26 12:47:03 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2019-10-26 12:51:17 +0100 |
commit | 5aeca580f43c5866794a630e35fa18dbfeefaa01 (patch) | |
tree | cf3fd37f8c7bfa3f665c5917ee6bd7843fb71865 /desktop | |
parent | 044ddd5d432aa94ff30851407b8c81875c655a83 (diff) | |
download | netsurf-5aeca580f43c5866794a630e35fa18dbfeefaa01.tar.gz netsurf-5aeca580f43c5866794a630e35fa18dbfeefaa01.tar.bz2 |
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 `<img src="about:logo"><img src="about:logo">` 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.
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/save_complete.c | 8 |
1 files 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); |