Automattic / Automattic/jetpack

Comments: Custom avatar on non ssl site shows mixed content error

Open
#3,474 3 comments 2 reactions 0 assignees View on GitHub
[Feature] Comments [Pri] Low Bug
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

#### What I expected

I expected that a custom avatar image being loaded over http instead of https would be copied to then served from an https wp.com address, probably via Photon
#### What happened instead

When you visit a page with comments enabled and it tries to show the default avatar you get Mixed Content errors. An example would be:

> Mixed Content: The page at 'https://jetpack.wordpress.com/jetpack-comment/?blogid=78781809&postid=1748&…94c2b12#parent=http%3A%2F%2Fwp.sandym.ca%2F2016%2F02%2Fjp-comments-test%2F' was loaded over HTTPS, but requested an insecure image 'http://wp.sandym.ca/wp-content/plugins/sandys-plugin//new-avatar.png'. This content should also be served over HTTPS.
#### Steps to reproduce the issue
- Add code similar to this to add a custom avatar
`if (!function_exists('custom_avatar')) {
function custom_avatar($avatar_defaults){
$new_default_icon = plugin_dir_url( __FILE__ ) . 'new-avatar.png';
$avatar_defaults[$new_default_icon] = 'custom avatar';
return $avatar_defaults;
}
add_filter('avatar_defaults','custom_avatar');
}
`
- In WP Admin go to Settings > Discussion and set the default avatar to be the custom one added.
- Visit a page using the Jetpack Comments module and view the console for error.

Seems this is being done around here:
higherlander-comments.php lines 420ff

Contributor guide

Open the contributing guide

Research direction

Read higherlander-comments.php around lines 420ff, then reproduce the issue by configuring a custom avatar and viewing Jetpack Comments on an HTTPS page. Confirm that the custom avatar is served from an HTTPS wp.com address and that the browser no longer reports a mixed-content error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.