Open Graph image property is a relative URL

Bug #1710747 reported by Kathy Lussier on 2017-08-15
This bug affects 1 person
Affects Status Importance Assigned to Milestone

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.

Kathy Lussier (klussier) wrote :

Working branch at;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
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/ from:

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


$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...

Dan Scott (denials) wrote :

My alternate branch, which ensures every other reference to ctx.media_prefix is absolute, is at;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) on 2017-08-18
Changed in evergreen:
status: New → Confirmed
Kathy Lussier (klussier) on 2017-08-23
Changed in evergreen:
assignee: nobody → Kathy Lussier (klussier)
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  Edit
Everyone can see this information.

Other bug subscribers