From aa1957861ab36130495d5181e31d5fb8954039c7 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 24 Nov 2016 08:42:51 +0100 Subject: [PATCH] Bug 17673: HTML5Media: Using an OPAC URL for an uploaded file does not always work in staff Content-Type: text/plain; charset=utf-8 If you did not fill OPACBaseURL, the media URL for an uploaded file will work in OPAC, but not in staff. You can solve that by filling OPACBaseURL correctly. We could also add a simple replace in C4/HTML5Media.pm. Test plan: [1] Add an upload (say .webm file) via 856$u in editor. Put 'video/webm' into 856$q. [2] Check media tab in opac and staff detail. --- C4/HTML5Media.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/C4/HTML5Media.pm b/C4/HTML5Media.pm index 1ac22f1..4093a2d 100644 --- a/C4/HTML5Media.pm +++ b/C4/HTML5Media.pm @@ -139,6 +139,10 @@ sub gethtml5media { hashvalue => $id, %public, })->next; next if !$upload || $upload->filename !~ /\./; + if( !$public{public} && + !C4::Context->preference('OPACBaseURL') ) { + $HTML5Media{srcblock} =~ s/opac-retrieve/opac\/opac-retrieve/; + } $HTML5Media{extension} = ( $upload->filename =~ m/([^.]+)$/ )[0]; } # check remote files -- 2.1.4