summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
460365d)
Server defaults to a predefined image so it never "fails" unless
requested. That image is hiding failures and Face/X-Face default
handling was never triggered, so to avoid detecting such image (which
is prone to future error):
- Force a 404 error from server if not found
- Detect also HTTP errors on curl call
Also:
- Handle less-than-minimum files like errors and made it misses too
g_free(escaped);
return url;
} else if (libravatarprefs.default_mode == DEF_MODE_NONE) {
g_free(escaped);
return url;
} else if (libravatarprefs.default_mode == DEF_MODE_NONE) {
- return g_strdup_printf("%s/%s?s=%u",
+ return g_strdup_printf("%s/%s?s=%u&d=404",
base, md5, AVATAR_SIZE);
}
base, md5, AVATAR_SIZE);
}
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, maxredirs);
}
curl_easy_setopt(curl, CURLOPT_FILE, file);
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, maxredirs);
}
curl_easy_setopt(curl, CURLOPT_FILE, file);
+ curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); /* fail on HTTP error */
debug_print("retrieving URL to file: %s -> %s\n", url, filename);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
debug_print("retrieving URL to file: %s -> %s\n", url, filename);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
- debug_print("curl_easy_perfom failed: %s", curl_easy_strerror(res));
+ debug_print("curl_easy_perfom failed: %s\n", curl_easy_strerror(res));
unlink(filename);
claws_fclose(file);
unlink(filename);
claws_fclose(file);
+ missing_add_md5(libravatarmisses, md5);
} else {
filesize = ftell(file);
claws_safe_fclose(file);
} else {
filesize = ftell(file);
claws_safe_fclose(file);
- if (filesize < MIN_PNG_SIZE)
+ if (filesize < MIN_PNG_SIZE) {
debug_print("not enough data for an avatar image: %ld bytes\n", filesize);
debug_print("not enough data for an avatar image: %ld bytes\n", filesize);
+ missing_add_md5(libravatarmisses, md5);
+ } else {
image = image_pixbuf_from_filename(filename);
image = image_pixbuf_from_filename(filename);
- if (!libravatarprefs.cache_icons || filesize == 0) {
+ if (!libravatarprefs.cache_icons || filesize < MIN_PNG_SIZE) {
if (g_unlink(filename) < 0)
g_warning("failed to delete cache file '%s'", filename);
}
if (g_unlink(filename) < 0)
g_warning("failed to delete cache file '%s'", filename);
}
-
- if (filesize == 0)
- missing_add_md5(libravatarmisses, md5);
}
curl_easy_cleanup(curl);
}
curl_easy_cleanup(curl);