]> git.evergreen-ils.org Git - Evergreen.git/commit
LP#1710747: Absolute URL for media_prefix in templates
authorDan Scott <dscott@laurentian.ca>
Tue, 15 Aug 2017 14:19:22 +0000 (10:19 -0400)
committerKathy Lussier <klussier@masslnc.org>
Wed, 23 Aug 2017 16:32:37 +0000 (12:32 -0400)
commit3725e10a63d41452ffc6951908d7c89ada82fe73
tree3a83e99a11ddc03a91da3efaa64ecb4e3670d56e
parent71871c25088e592848b90b8deba70bc6d7347d30
LP#1710747: Absolute URL for media_prefix in templates

If OILSWebMediaPrefix is set in the Apache configuration, then
the ctx.media_prefix TT2 template variable uses that value as the
hostname; otherwise it is null, resulting in many relative URLs for
images, CSS, and JavaScript files.

Normally this is not a problem, but the Open Graph image property
requires a full absolute URL rather than the relative URL that would
previously result on the record summary page in the absence of the
OILSWebMediaPrefix variable having been set in the Apache config.

This patch tweaks the EGWeb handler to fall back to the base hostname in
the absence of the OILSWebMediaPrefix variable, thus ensuring that all
uses of ctx.media_prefix result in an absolute URL.

Test Plan:
Pre-patch - Visit a record summary page in the catalog. View the source of the
page. In the head section, find the og:image meta property. The content will
display a relative URL to the record's book jacket cover image.

Post-patch - When viewing the source of the page, og:image will display the
full URL.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm