Given a stylesheet linked like:
There is some weird behavior when passing in a baseurl that doesn't have a protocol. First, no protocol at all:
The passing in a protocol relative url:
My expectation would be that protocol relative URLs would be left alone for the purposes of getting assets in documents, regardless of a baseurl. A customer reported a variant of this in which the protocol relative URLs inside their stylesheet were being mishandled.
An interesting side effect of this is that Prince can be forced to read files from anywhere on the FS with this, which is not great, but also probably not a huge concern for most users.
<link rel="stylesheet" href="//d1030xxn62fyyb.cloudfront.net/assets/application-5c5c338a5fdfbb53174216d6a68a264a740f3b04ef761e980241c79faddc9e1f.css">
There is some weird behavior when passing in a baseurl that doesn't have a protocol. First, no protocol at all:
$ vendor/prince/versions/11.2/lib/prince/bin/prince --server -vvv --baseurl=docraptor.com --media=all --input=html ~/support/baseurl-test.html
msg|inf||loading document: vendor/prince/versions/11.2/lib/prince/license/license.dat
sta|Loading document...
msg|inf||loading HTML5 input: /Users/joel/support/baseurl-test.html
msg|inf||loading document: /Users/joel/support/baseurl-test.html
sta|Applying style sheets...
msg|inf||loading style sheet: /d1030xxn62fyyb.cloudfront.net/assets/application-5c5c338a5fdfbb53174216d6a68a264a740f3b04ef761e980241c79faddc9e1f.css
msg|wrn|/d1030xxn62fyyb.cloudfront.net/assets/application-5c5c338a5fdfbb53174216d6a68a264a740f3b04ef761e980241c79faddc9e1f.css|can't open input file: No such file or directory
sta|Preparing document...
sta|Converting document...
prg|0
msg|inf||used font: Times New Roman, Bold
msg|inf||used font: Times New Roman, Regular
prg|100
fin|success
The passing in a protocol relative url:
$ vendor/prince/versions/11.2/lib/prince/bin/prince --server -vvv --baseurl=//docraptor.com --media=all --input=html ~/support/baseurl-test.html
msg|inf||loading document: vendor/prince/versions/11.2/lib/prince/license/license.dat
sta|Loading document...
msg|inf||loading HTML5 input: /Users/joel/support/baseurl-test.html
msg|inf||loading document: /Users/joel/support/baseurl-test.html
sta|Applying style sheets...
msg|inf||loading style sheet: /d1030xxn62fyyb.cloudfront.net/assets/application-5c5c338a5fdfbb53174216d6a68a264a740f3b04ef761e980241c79faddc9e1f.css
msg|wrn|/d1030xxn62fyyb.cloudfront.net/assets/application-5c5c338a5fdfbb53174216d6a68a264a740f3b04ef761e980241c79faddc9e1f.css|can't open input file: No such file or directory
sta|Preparing document...
sta|Converting document...
prg|0
msg|inf||used font: Times New Roman, Bold
msg|inf||used font: Times New Roman, Regular
prg|100
fin|success
My expectation would be that protocol relative URLs would be left alone for the purposes of getting assets in documents, regardless of a baseurl. A customer reported a variant of this in which the protocol relative URLs inside their stylesheet were being mishandled.
An interesting side effect of this is that Prince can be forced to read files from anywhere on the FS with this, which is not great, but also probably not a huge concern for most users.