File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
contrib/userDataProfile/browser
services/userDataProfile/browser Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
35
35
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
36
36
import { CONFIG_NEW_WINDOW_PROFILE } from 'vs/workbench/common/configuration' ;
37
37
import { ResourceMap } from 'vs/base/common/map' ;
38
+ import { getErrorMessage } from 'vs/base/common/errors' ;
38
39
39
40
export type ChangeEvent = {
40
41
readonly name ?: boolean ;
@@ -841,6 +842,16 @@ export class UserDataProfilesEditorModel extends EditorModel {
841
842
}
842
843
this . revert ( ) ;
843
844
}
845
+
846
+ if ( copyFrom instanceof URI ) {
847
+ try {
848
+ await this . userDataProfileImportExportService . resolveProfileTemplate ( copyFrom ) ;
849
+ } catch ( error ) {
850
+ this . dialogService . error ( getErrorMessage ( error ) ) ;
851
+ return ;
852
+ }
853
+ }
854
+
844
855
if ( ! this . newProfileElement ) {
845
856
const disposables = new DisposableStore ( ) ;
846
857
const cancellationTokenSource = new CancellationTokenSource ( ) ;
Original file line number Diff line number Diff line change @@ -819,9 +819,16 @@ export class UserDataProfileImportExportService extends Disposable implements IU
819
819
return null ;
820
820
}
821
821
822
- const profileTemplate : Mutable < IUserDataProfileTemplate > = JSON . parse ( profileContent ) ;
822
+ let profileTemplate : Mutable < IUserDataProfileTemplate > ;
823
+
824
+ try {
825
+ profileTemplate = JSON . parse ( profileContent ) ;
826
+ } catch ( error ) {
827
+ throw new Error ( localize ( 'invalid profile content' , "This profile is not valid." ) ) ;
828
+ }
829
+
823
830
if ( ! isUserDataProfileTemplate ( profileTemplate ) ) {
824
- throw new Error ( 'Invalid profile content.' ) ;
831
+ throw new Error ( localize ( 'invalid profile content' , "This profile is not valid." ) ) ;
825
832
}
826
833
827
834
if ( options ?. name ) {
You can’t perform that action at this time.
0 commit comments