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

MM-14446: consider subpath when evaluating if url is internal #946

Merged
merged 5 commits into from
Mar 15, 2019

Conversation

lieut-data
Copy link
Member

Summary
When clicking on an URL with target=_blank, the webview decides if it should launch an external browser or a new window within the Electron application. Update this logic to consider the application's configured subpath so as to treat links outside the subpath but on the same domain as external.

Issue link
https://mattermost.atlassian.net/browse/MM-14446

Test Cases
Added unit tests for helper function that tests if the target URL is internal. Tested with a subpath configured and without, verifying that links to different domains and different subpaths on the same domain are handled externally in the live build.

When clicking on an URL with `target=_blank`, the webview decides if it should launch an external browser or a new window within the Electron application. Update this logic to consider the application's configured subpath so as to treat links outside the subpath but on the same domain as external.
@lieut-data lieut-data added the 2: Dev Review Requires review by a core committer label Mar 8, 2019
@lieut-data lieut-data requested review from yuya-oc and crspeller March 8, 2019 18:14
@@ -0,0 +1,48 @@
// Copyright (c) 2015-2016 Yuya Ochiai
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Member Author

Choose a reason for hiding this comment

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

I admit I don't know the policy here, having just copied the license header from another file. Should I omit @yuya-oc's copyright on this file?

Copy link
Member

Choose a reason for hiding this comment

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

Well he didn't write it. No idea why it's on the others. I think legally it's fine because the CLA doesn't sign over copyright just an indefinite license.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, now I know why:

/root/mattermost-desktop/test/specs/utils/util_test.js
  3:1  error  incorrect header  header/header

Fixing this by making the header/header rule apply to a hard-coded list of files, and going forward will only require the mattermost license on new files.

@esethna esethna added this to the v4.3.0 milestone Mar 12, 2019
@esethna esethna modified the milestones: v4.3.0, v4.2.0 Mar 13, 2019
@esethna esethna requested a review from hmhealey March 13, 2019 21:17
@esethna
Copy link
Contributor

esethna commented Mar 13, 2019

Adding HH for a second review before merge (as Yuya is not very available this month)

@esethna
Copy link
Contributor

esethna commented Mar 13, 2019

Given customer urgency we'll take this for a v4.2 dot release

@hmhealey hmhealey added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Mar 15, 2019
@hmhealey
Copy link
Member

I just left this as ready to merge since I don't know the process for merging this for a 4.2 dot release

@wget wget merged commit 79e020b into master Mar 15, 2019
wget pushed a commit that referenced this pull request Mar 15, 2019
* MM-14446: consider subpath when evaluating if url is internal

When clicking on an URL with `target=_blank`, the webview decides if it should launch an external browser or a new window within the Electron application. Update this logic to consider the application's configured subpath so as to treat links outside the subpath but on the same domain as external.

* fix licensing on new file

* fix .eslintrc.json indentation

* tweak header eslint rules for specific files
wget pushed a commit that referenced this pull request Mar 24, 2019
* MM-14446: consider subpath when evaluating if url is internal

When clicking on an URL with `target=_blank`, the webview decides if it should launch an external browser or a new window within the Electron application. Update this logic to consider the application's configured subpath so as to treat links outside the subpath but on the same domain as external.

* fix licensing on new file

* fix .eslintrc.json indentation

* tweak header eslint rules for specific files
wget pushed a commit that referenced this pull request Mar 24, 2019
* MM-14446: consider subpath when evaluating if url is internal

When clicking on an URL with `target=_blank`, the webview decides if it should launch an external browser or a new window within the Electron application. Update this logic to consider the application's configured subpath so as to treat links outside the subpath but on the same domain as external.

* fix licensing on new file

* fix .eslintrc.json indentation

* tweak header eslint rules for specific files
@wget wget deleted the MM-14446-fix-non-subpath-links branch July 3, 2019 14:37
JtheBAB pushed a commit to JtheBAB/desktop that referenced this pull request Jan 17, 2020
…most#946)

* MM-14446: consider subpath when evaluating if url is internal

When clicking on an URL with `target=_blank`, the webview decides if it should launch an external browser or a new window within the Electron application. Update this logic to consider the application's configured subpath so as to treat links outside the subpath but on the same domain as external.

* fix licensing on new file

* fix .eslintrc.json indentation

* tweak header eslint rules for specific files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants