mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
Allow http/https only for Flash from URL
Change-type: patch Changelog-entry: Allow http/https only for Flash from URL Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzothunder.ambrosi@gmail.com>
This commit is contained in:
parent
ac2e973cb0
commit
39ed67d667
@ -47,7 +47,7 @@ import { SVGIcon } from '../svg-icon/svg-icon';
|
||||
|
||||
const recentUrlImagesKey = 'recentUrlImages';
|
||||
|
||||
function normalizeRecentUrlImages(urls: any[]): string[] {
|
||||
function normalizeRecentUrlImages(urls: any): string[] {
|
||||
if (!Array.isArray(urls)) {
|
||||
urls = [];
|
||||
}
|
||||
@ -362,6 +362,19 @@ export class SourceSelector extends React.Component<
|
||||
path: imagePath,
|
||||
});
|
||||
} else {
|
||||
if (
|
||||
!_.startsWith(imagePath, 'https://') &&
|
||||
!_.startsWith(imagePath, 'http://')
|
||||
) {
|
||||
const invalidImageError = errors.createUserError({
|
||||
title: 'Unsupported protocol',
|
||||
description: messages.error.unsupportedProtocol(),
|
||||
});
|
||||
|
||||
osDialog.showError(invalidImageError);
|
||||
analytics.logEvent('Unsupported protocol', { path: imagePath });
|
||||
return;
|
||||
}
|
||||
source = new sourceDestination.Http(imagePath);
|
||||
}
|
||||
|
||||
|
@ -191,4 +191,8 @@ export const error = {
|
||||
'Please try again, and contact the Etcher team if the problem persists.',
|
||||
].join(' ');
|
||||
},
|
||||
|
||||
unsupportedProtocol: () => {
|
||||
return 'Only http:// and https:// URLs are supported.';
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user