[open-ils-commits] [GIT] Evergreen ILS branch rel_2_11 updated. b10e144f182d6f2463bc7f435d7427a94c5cd16a

Evergreen Git git at git.evergreen-ils.org
Wed Aug 23 12:35:34 EDT 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_11 has been updated
       via  b10e144f182d6f2463bc7f435d7427a94c5cd16a (commit)
      from  68e4457925d14b2eb263cef58d2600c73185ac49 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b10e144f182d6f2463bc7f435d7427a94c5cd16a
Author: Dan Scott <dscott at laurentian.ca>
Date:   Tue Aug 15 10:19:22 2017 -0400

    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 at laurentian.ca>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
index da18d7e..adc3438 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
@@ -208,8 +208,8 @@ sub load_context {
     $ctx->{base_path} = $r->dir_config('OILSWebBasePath');
     $ctx->{web_dir} = $r->dir_config('OILSWebWebDir');
     $ctx->{debug_template} = ($r->dir_config('OILSWebDebugTemplate') =~ /true/io) ? 1 : 0;
-    $ctx->{media_prefix} = $r->dir_config('OILSWebMediaPrefix');
     $ctx->{hostname} = $r->hostname;
+    $ctx->{media_prefix} = $r->dir_config('OILSWebMediaPrefix') || $ctx->{hostname};
     $ctx->{base_url} = $cgi->url(-base => 1);
     $ctx->{skin} = $cgi->cookie(OILS_HTTP_COOKIE_SKIN) || 'default';
     $ctx->{theme} = $cgi->cookie(OILS_HTTP_COOKIE_THEME) || 'default';

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list