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.
This commit is contained in:
Michael Drake 2019-10-26 12:47:03 +01:00
parent 044ddd5d43
commit 5aeca580f4

View File

@ -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);