phloxic / videojs-sprite-thumbnails

Video.js plugin to display thumbnails from a sprite image when hovering over the progress bar
https://lastshiphome.de/en/movie
MIT License
52 stars 13 forks source link

Strange behavior when "&" is part of sprite URL #26

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello,

as your plug does currently not respect videojs.Vhs.xhr.beforeRequest to set a Token for authorization, I tried to use a signed s3 link instead. But as soon as I pass the link to your script it seems that all "&" are swapped out for an ";" which again breaks the signed link as it has changed.

The funny fact here is that If I directly set the string (hard-coded) it works, If I pass it into the script via a call from my Framework I get this mess. I already validated that the generated link I pass is valid, as I can display it normally in my template where I also use VideoJS and your plugin. So the issue has to be at your plugin I guess.

My application generates the link to download the sprites.png, which looks like this: https://localhost/vod/Movies/test/sprites.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=2PsuWGctH4UQmGvEQYjTDsZ2HqGM%2F20220601%2Fminio%2Fs3%2Faws4_request&X-Amz-Date=20220601T153759Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=cd575bd79883f1fec4e50cb14b2973bac7305f14517b7ca2a39f3f419b672b92

As soon as I call the template and the player starts, I can see that your plugin tries to download the sprites.png, but the link has changed for some reason, all & are swapped for an ";". This is the link that get s called instead: https://localhost/vod/Movies/test/sprites.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=2PsuWGctH4UQmGvEQYjTDsZ2HqGM%2F20220601%2Fminio%2Fs3%2Faws4_request&X-Amz-Date=20220601T153759Z&X-Amz-Expires=300&X-Amz-SignedHeaders=host&X-Amz-Signature=cd575bd79883f1fec4e50cb14b2973bac7305f14517b7ca2a39f3f419b672b92

Any Idea?

Kind regards

phloxic commented 2 years ago

The ampersands & are escaped into html entities & (not ;). Depending on how you generate the links and how they are parsed, you may have to replace the entities with literals again.