Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(FEC-8998): add url encoded for referrer token #299

Merged
merged 5 commits into from
Jan 29, 2020

Conversation

RoyBregman
Copy link
Contributor

@RoyBregman RoyBregman commented Jan 23, 2020

Description of the Changes

add new property "encodedReferrer" to plugins config model which uses a new method getEncodedReferrer in kaltura-params which encodes the getReferrer

solves FEC-8998

CheckLists

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • test are passing in local environment
  • Travis tests are passing (or test results are not worse than on master branch :))
  • Docs have been updated

* @return {string} - The referrer after URIComponent encoded
* @private
*/
function getEncodedReferrer(): string {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's not relevant to kaltura-params.js move it to plugins-config.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yairans please check approve

*/
function getEncodedReferrer(): string {
const referrer = getReferrer();
return typeof referrer === 'string' ? encodeURIComponent(referrer) : referrer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we typeof this because of flow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when can it be undefined or not a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in reality according to the current implementation of getReferrer it doesn't seem possible. Still i think it is good to be sure and wrap it in case getReferrer returns undefined in some weird scenario (for example an old browser or something)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I follow - do you know old browsers return undefined? according to MDN it is always a string: https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed check

OrenMe
OrenMe previously approved these changes Jan 26, 2020
@yairans yairans self-requested a review January 29, 2020 10:24
@RoyBregman RoyBregman merged commit b540625 into master Jan 29, 2020
@SivanA-Kaltura SivanA-Kaltura deleted the FEC-8998-encoded-referrer branch December 12, 2022 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants