Bug 27422

Summary: HTML5Media is http by default but Youtube is https only
Product: Koha Reporter: Didier Gautheron <didier.gautheron>
Component: CatalogingAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: andrew, caroline.cyr-la-rose, dcook, fridolin.somers, m.de.rooy, tomascohen, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.03,20.05.09,19.11.15
Circulation function:
Attachments: Bug 27422: YouTube videos are HTTPS only
Bug 27422: YouTube videos are HTTPS only
Bug 27422: YouTube videos are HTTPS only

Description Didier Gautheron 2021-01-13 12:17:26 UTC
Hi

Unless 856 indicator is 7 and you set 856$2 to https koha is using http not htpps 
even if 856$u is like https://youtube.com/xxx. But it seems youtube isn't using http anymore. 
if HTML5MediaEnabled is true there's a media tab but it's empty

eg:
Comment 1 Tomás Cohen Arazi (tcohen) 2021-02-03 22:58:55 UTC
Created attachment 116297 [details] [review]
Bug 27422: YouTube videos are HTTPS only

This patch hardcodes HTTPS as the protocol to use when generating
YouTube content embedding. It is the supported protocol and without this
patch it falls back to 'http', or it can be 'ftp' depending on the first
indicator of the 856 field. They are all not supported so hardcoding it.

To test:
1. Have a record with 856 $uhttps://youtu.be/sMNkDPFycNU
2. Enable the HTML5MediaYouTube and HTML5Media sysprefs
3. Open the OPAC detailed view of the record
4. Open the Multimedia tab
=> FAIL: There's no embedded video
5. Apply this patch
6. Restart all
7. Repeat 4
=> SUCCESS: There's a live performance of Heroes del Silencio!
8. Sign off :-D

Sponsored-by: Banco Central de la República Argentina

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Tomás Cohen Arazi (tcohen) 2021-02-03 23:02:52 UTC
This should be backported to all stable branches.
Comment 3 David Cook 2021-02-04 05:18:44 UTC
Hmm, I have no problem without the patch. I do see that https://youtu.be/sMNkDPFycNU has been changed to http://www.youtube.com/embed/sMNkDPFycNU in the iframe though. 

I'm going to try the patch anyway though because changing HTTPS to HTTP is silly.
Comment 4 David Cook 2021-02-04 05:21:36 UTC
Created attachment 116308 [details] [review]
Bug 27422: YouTube videos are HTTPS only

This patch hardcodes HTTPS as the protocol to use when generating
YouTube content embedding. It is the supported protocol and without this
patch it falls back to 'http', or it can be 'ftp' depending on the first
indicator of the 856 field. They are all not supported so hardcoding it.

To test:
1. Have a record with 856 $uhttps://youtu.be/sMNkDPFycNU
2. Enable the HTML5MediaYouTube and HTML5Media sysprefs
3. Open the OPAC detailed view of the record
4. Open the Multimedia tab
=> FAIL: There's no embedded video
5. Apply this patch
6. Restart all
7. Repeat 4
=> SUCCESS: There's a live performance of Heroes del Silencio!
8. Sign off :-D

Sponsored-by: Banco Central de la República Argentina

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 5 Katrin Fischer 2021-02-07 11:38:17 UTC
Created attachment 116463 [details] [review]
Bug 27422: YouTube videos are HTTPS only

This patch hardcodes HTTPS as the protocol to use when generating
YouTube content embedding. It is the supported protocol and without this
patch it falls back to 'http', or it can be 'ftp' depending on the first
indicator of the 856 field. They are all not supported so hardcoding it.

To test:
1. Have a record with 856 $uhttps://youtu.be/sMNkDPFycNU
2. Enable the HTML5MediaYouTube and HTML5Media sysprefs
3. Open the OPAC detailed view of the record
4. Open the Multimedia tab
=> FAIL: There's no embedded video
5. Apply this patch
6. Restart all
7. Repeat 4
=> SUCCESS: There's a live performance of Heroes del Silencio!
8. Sign off :-D

Sponsored-by: Banco Central de la República Argentina

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Jonathan Druart 2021-02-08 16:05:03 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 7 Fridolin Somers 2021-02-12 14:29:12 UTC
Small useful, I choose to backport.

Pushed to 20.11.x for 20.11.03
Comment 8 Andrew Fuerste-Henry 2021-02-18 13:39:26 UTC
Pushed to 20.05.x for 20.05.09
Comment 9 Victor Grousset/tuxayo 2021-02-21 00:58:27 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.
Comment 10 Tomás Cohen Arazi (tcohen) 2021-02-21 01:04:36 UTC
(In reply to Victor Grousset/tuxayo from comment #9)
> Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.

Please backport it. It is a broken feature without it. Thanks
Comment 11 Victor Grousset/tuxayo 2021-02-22 02:17:26 UTC
Backported: Pushed to 19.11.x branch for 19.11.15
Comment 12 Victor Grousset/tuxayo 2021-02-22 02:19:51 UTC
> Please backport it. It is a broken feature without it. Thanks

Ok, I didn't understood that from the severity and description. Done! :)

Though I'm still confused as in my testing it still works without the patch.
Comment 13 David Cook 2021-02-22 03:00:11 UTC
(In reply to Victor Grousset/tuxayo from comment #12)
> Though I'm still confused as in my testing it still works without the patch.

Same
Comment 14 Tomás Cohen Arazi (tcohen) 2021-02-22 03:32:40 UTC
(In reply to Victor Grousset/tuxayo from comment #12)
> > Please backport it. It is a broken feature without it. Thanks
> 
> Ok, I didn't understood that from the severity and description. Done! :)
> 
> Though I'm still confused as in my testing it still works without the patch.

It might be related to some specific browsers not accepting http on iframes. I'm not sure. We've been having reports since December and we ground this bug.
I usually try Firefox, Chrome and Safari.
Comment 15 Victor Grousset/tuxayo 2021-02-26 21:45:20 UTC
> It might be related to some specific browsers not accepting http on iframes.

Must be that! My local Koha isn't in HTTPS, but if it was, maybe the issue would happen.