Skip to content

Conversation

@connorjclark
Copy link
Collaborator

ref #12868


Commit with message:

Co-authored-by: André Van Dal <[email protected]>

@connorjclark connorjclark requested a review from a team as a code owner August 5, 2021 20:38
@connorjclark connorjclark requested review from patrickhulce and removed request for a team August 5, 2021 20:38
@google-cla google-cla bot added the cla: yes label Aug 5, 2021
*/
safelySetHref(elem, url) {
// Defaults to '' to fix proto roundtrip issue.
url = url || '';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

doing this instead of default param value, because that makes typescript make the second param optional.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

thanks @derevandal !

* Set link href, but safely, preventing `javascript:` protocol, etc.
* @see https://github.com/google/safevalues/
* @param {HTMLAnchorElement} elem
* @param {string} url
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @param {string} url
* @param {string|undefined} url

Copy link
Collaborator Author

@connorjclark connorjclark Aug 5, 2021

Choose a reason for hiding this comment

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

I'd prefer not littering our types with this, just because a use case comes to us from proto. If we were to go down that route, we should turn all string into string|undefined in the report.

We've got to address the root cause eventually, maybe changes like this would be included in that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

we should turn all string into string|undefined in the report.

I agree :)

If you want to postpone this for a more thorough examination of all usage that wfm though.

Co-authored-by: Patrick Hulce <[email protected]>
@connorjclark connorjclark merged commit 25fd665 into master Aug 5, 2021
@connorjclark connorjclark deleted the fix-href branch August 5, 2021 21:31
Copy link
Contributor

@andrevandal andrevandal left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants