Description
Short description of the issue
Trying to set image on existing page via API causes
Exception: Download URLs must begin with http:// or https:// (in /application/wire/core/WireHttp.php line 643)
Expected behavior
Image should be downloaded and saved to page.
Actual behavior
Error: Exception: Download URLs must begin with http:// or https:// (in /application/wire/core/WireHttp.php line 643)
#0 /application/wire/core/Pagefile.php(167): ProcessWire\WireHttp->download('', '/application/si...')
#1 /application/wire/core/Pageimage.php(1534): ProcessWire\Pagefile->___install('https://bookdir...')
#2 /application/wire/core/Wire.php(383): ProcessWire\Pageimage->___install('https://bookdir...')
#3 /application/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___install', Array)
#4 /application/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\Pageimage), 'install', Array)
#5 /application/wire/core/Pagefile.php(115): ProcessWire\Wire->__call('install', Array)
#6 /application/wire/core/Pagefile.php(88): ProcessWire\Pagefile->setFilename('https://bookdir...')
#7 /application/wire/core/Pageimage.php(118): ProcessWire\Pagefile->_construct(Object(ProcessWire\Pageimages), 'https://bookdir...')
#8 /application/wire/core/Pageimages.php(53): ProcessWire\Pageimage->
This error message was shown because: you are logged in as a Superuser. Error has been logged.
Optional: Suggestion for a possible fix
Bug seems, to reside with Sanitizer::url()
Passing the raw image URL to Sanitizer returns an empty string, the image URL below.
https://bookdirect_venue_images.s3.amazonaws.com/1520896236355-E4wlUG7UTORst5nE.jpg
(please let me know if this image is no longer live and I will replace, the system periodicaly replaces them)
Steps to reproduce the issue
Try to set the above link to and image field and save, or passed through Sanitizer::url().
Setup/Environment
Docker, NGINX, php-fpm
- ProcessWire version: 3.0.98
- (Optional) PHP version: 7.2
- (Optional) MySQL version: MariaDB (latest)