[GH-1635] don't validate custom protocol URLs (#1889)
* don't validate custom protocol URLs * added unit tests for invalid URLs with custom protocols
This commit is contained in:
@@ -185,7 +185,7 @@ describe('main/views/webContentsEvents', () => {
|
||||
|
||||
it('should deny invalid URI', () => {
|
||||
urlUtils.isValidURI.mockReturnValue(false);
|
||||
expect(newWindow({url: 'baduri::'})).toStrictEqual({action: 'deny'});
|
||||
expect(newWindow({url: 'http::'})).toStrictEqual({action: 'deny'});
|
||||
});
|
||||
|
||||
it('should divert to allowProtocolDialog for custom protocols that are not mattermost or http', () => {
|
||||
@@ -193,6 +193,11 @@ describe('main/views/webContentsEvents', () => {
|
||||
expect(allowProtocolDialog.handleDialogEvent).toBeCalledWith('spotify:', 'spotify:album:2OZbaW9tgO62ndm375lFZr');
|
||||
});
|
||||
|
||||
it('should divert to allowProtocolDialog for invalid URIs with custom protocols', () => {
|
||||
expect(newWindow({url: 'customproto:test\\data'})).toStrictEqual({action: 'deny'});
|
||||
expect(allowProtocolDialog.handleDialogEvent).toBeCalledWith('customproto:', 'customproto:test\\data');
|
||||
});
|
||||
|
||||
it('should open in the browser when there is no server matching', () => {
|
||||
urlUtils.getView.mockReturnValue(null);
|
||||
expect(newWindow({url: 'http://server-2.com/subpath'})).toStrictEqual({action: 'deny'});
|
||||
|
Reference in New Issue
Block a user