Open Graph image property is a relative URL

Bug #1710747 reported by Kathy Lussier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Low
Unassigned
2.11
Fix Released
Low
Unassigned

Bug Description

The Open Graph image property in the head section of the record summary page uses a relative URL for the book jacket image when a full absolute URL is required. As a result, when sharing pages to Facebook, for example, the site often is unable to identify and display the book jacket cover image with the other contents of the shared link.

Tags: pullrequest
Revision history for this message
Kathy Lussier (klussier) wrote :

Working branch at http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/kmlussier/lp1710747-open-graph-image-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.

tags: added: pullrequest
Changed in evergreen:
assignee: Kathy Lussier (klussier) → nobody
Revision history for this message
Dan Scott (denials) wrote :

Thanks for this, Kathy! I'm concerned that there might be a deeper problem here, as ctx.media_prefix is used elsewhere to point to the hostname where the media is served from, which could be different from ctx.hostname. (Historically the division was to overcome the maximum number of parallel connections that browsers would make to a single hostname).

But if ctx.media_prefix is unset, then in this context it is null and seems to be null in every other use within src="" attributes in other templates.

A different approach would be to modify OpenILS/WWW/EGWeb.pm from:

$ctx->{media_prefix} = $r->dir_config('OILSWebMediaPrefix');

to:

$ctx->{media_prefix} = $r->dir_config('OILSWebMediaPrefix') || $r->hostname;

That is, ensuring that ctx.media_prefix is always set to an explicit hostname, thus making every reference absolute. This would also avoid modifying every OPAC and KPAC reference to ctx.media_prefix too :)

I'll test and post an alternate branch if I'm successful...

Revision history for this message
Dan Scott (denials) wrote :

My alternate branch, which ensures every other reference to ctx.media_prefix is absolute, is at http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dbs/lp1710747-absolute-url-media-prefix

I have this patch running in production on our 2.12 system.

Dan Scott (denials)
Changed in evergreen:
status: New → Confirmed
Kathy Lussier (klussier)
Changed in evergreen:
assignee: nobody → Kathy Lussier (klussier)
Revision history for this message
Kathy Lussier (klussier) wrote :

Works for me. Thank you Dan!

Merged to master, release 2.12 and release 2.11.

Changed in evergreen:
assignee: Kathy Lussier (klussier) → nobody
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.