Skip to content

Commit

Permalink
amp-pixel only allows https src attribute values
Browse files Browse the repository at this point in the history
  • Loading branch information
obeyer committed Mar 16, 2017
1 parent 77acbcb commit d7cbdf6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Pass/ImgTagTransformPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ protected function convertAmpPixel($el, $lineno, $context_string)
{
$dom_el = $el->get(0);
$new_dom_el = $dom_el->ownerDocument->createElement('amp-pixel');
$new_dom_el->setAttribute('src', $el->attr('src'));
$src = $el->attr('src');
if (strpos($src, 'http://') !== false) {
$src = str_replace('http://', 'https://', $src);
}
$new_dom_el->setAttribute('src', $src);
$dom_el->parentNode->insertBefore($new_dom_el, $dom_el);
$this->addActionTaken(new ActionTakenLine('img', ActionTakenType::IMG_PIXEL_CONVERTED, $lineno, $context_string));
return $new_dom_el;
Expand Down

0 comments on commit d7cbdf6

Please sign in to comment.