File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -273,8 +273,22 @@ export abstract class TemplateEngine extends QuickAddEngine {
273273 }
274274
275275 private showInvalidFolderNotice ( error : Error ) : void {
276- const message = error . message . replace ( / ^ F i l e n a m e \b / , "Folder name" ) ;
277- new Notice ( message ) ;
276+ new Notice ( this . formatInvalidFolderMessage ( error . message ) ) ;
277+ }
278+
279+ private formatInvalidFolderMessage ( message : string ) : string {
280+ const invalidCharsMatch = message . match (
281+ / ^ F i l e n a m e c a n n o t c o n t a i n a n y o f t h e f o l l o w i n g c h a r a c t e r s : \s * ( .+ ) $ / u,
282+ ) ;
283+ if ( invalidCharsMatch ?. [ 1 ] ) {
284+ return `Folder name cannot contain any of the following characters: ${ invalidCharsMatch [ 1 ] } ` ;
285+ }
286+
287+ if ( message . startsWith ( "File name " ) ) {
288+ return `Folder name ${ message . slice ( "File name " . length ) } ` ;
289+ }
290+
291+ return "Invalid folder name." ;
278292 }
279293
280294 private isPathAllowed ( path : string , roots : string [ ] ) : boolean {
You can’t perform that action at this time.
0 commit comments