Skip to content

Commit 607878b

Browse files
Scott DoverScott Dover
authored andcommitted
chore: update folder validation
Signed-off-by: Scott Dover <[email protected]>
1 parent afc42a7 commit 607878b

File tree

10 files changed

+16
-12
lines changed

10 files changed

+16
-12
lines changed

client/src/components/ContentNavigator/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const Messages = {
8181
FolderDeletionError: l10n.t("Unable to delete folder."),
8282
FolderRestoreError: l10n.t("Unable to restore folder."),
8383
FolderValidationError: l10n.t(
84-
"The folder name cannot contain more than 100 characters.",
84+
"The folder name cannot contain more than 100 characters or have invalid characters.",
8585
),
8686
NewFileCreationError: l10n.t('Unable to create file "{name}".'),
8787
NewFilePrompt: l10n.t("Enter a file name."),

client/src/components/ContentNavigator/index.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,19 @@ const flowFileValidator = (value: string): string | null => {
4747
return res;
4848
};
4949

50-
const folderValidator = (value: string): string | null =>
51-
value.length <= 100 ? null : Messages.FolderValidationError;
50+
const folderValidator = (
51+
value: string,
52+
sourceType: ContentSourceType,
53+
): string | null => {
54+
const regex =
55+
sourceType === ContentSourceType.SASServer
56+
? new RegExp(/[:/?\\*"|<>]/g)
57+
: new RegExp(/[/;\\{}<>]/g);
58+
59+
return value.length <= 100 && !regex.test(value)
60+
? null
61+
: Messages.FolderValidationError;
62+
};
5263

5364
class ContentNavigator implements SubscriptionProvider {
5465
private contentDataProvider: ContentDataProvider;
@@ -187,7 +198,8 @@ class ContentNavigator implements SubscriptionProvider {
187198
const folderName = await window.showInputBox({
188199
prompt: Messages.NewFolderPrompt,
189200
title: Messages.NewFolderTitle,
190-
validateInput: folderValidator,
201+
validateInput: (folderName) =>
202+
folderValidator(folderName, this.sourceType),
191203
});
192204
if (!folderName) {
193205
return;

l10n/bundle.l10n.de.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "Der Task ist erledigt.",
104104
"The SAS session has closed.": "Die SAS Session wurde beendet.",
105105
"The file type is unsupported.": "Der Dateityp wird nicht unterstützt",
106-
"The folder name cannot contain more than 100 characters.": "Der Ordnername kann nicht mehr als 100 Zeichen lang sein.",
107106
"The item could not be added to My Favorites.": "Der Inhalt konnte nicht zu Meinen Favoriten hinzugefügt werden.",
108107
"The item could not be removed from My Favorites.": "Der Inhalt konnte nicht aus Meinen Favoriten entfernt werden.",
109108
"The notebook file does not contain any code to convert.": "Das Notebook enthält keinen zu konvertierenden Code.",

l10n/bundle.l10n.es.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "La tarea está completada.",
104104
"The SAS session has closed.": "Se ha cerrado la sesión SAS.",
105105
"The file type is unsupported.": "El tipo de archivo no es compatible.",
106-
"The folder name cannot contain more than 100 characters.": "El nombre de la carpeta no puede contener más de 100 caracteres.",
107106
"The item could not be added to My Favorites.": "El elemento no se ha podido añadir a Mis favoritos.",
108107
"The item could not be removed from My Favorites.": "El elemento no se ha podido quitar de Mis favoritos.",
109108
"The notebook file does not contain any code to convert.": "El archivo de bloc de notas no contiene ningún código para convertir.",

l10n/bundle.l10n.fr.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "La tâche est terminée.",
104104
"The SAS session has closed.": "La session SAS s'est fermée.",
105105
"The file type is unsupported.": "Le type de fichier n'est pas pris en charge.",
106-
"The folder name cannot contain more than 100 characters.": "Le nom du dossier ne peut pas contenir plus de 100 caractères.",
107106
"The item could not be added to My Favorites.": "Impossible d'ajouter l'élément à Mes favoris.",
108107
"The item could not be removed from My Favorites.": "Impossible de supprimer l'élément de Mes favoris.",
109108
"The notebook file does not contain any code to convert.": "Le fichier de notebook ne contient aucun code à convertir.",

l10n/bundle.l10n.it.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "Il task è completo.",
104104
"The SAS session has closed.": "La sessione SAS è stata chiusa.",
105105
"The file type is unsupported.": "Il tipo di file non è supportato.",
106-
"The folder name cannot contain more than 100 characters.": "Il nome della cartella non può contenere più di 100 caratteri.",
107106
"The item could not be added to My Favorites.": "Impossibile aggiungere l’elemento ai Preferiti.",
108107
"The item could not be removed from My Favorites.": "Impossibile rimuovere l’elemento dai Preferiti.",
109108
"The notebook file does not contain any code to convert.": "Il file del notebook non contiene codice da convertire.",

l10n/bundle.l10n.ja.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "タスクは完了しました。",
104104
"The SAS session has closed.": "SAS セッションが終了しました。",
105105
"The file type is unsupported.": "ファイルの種類はサポートされていません。",
106-
"The folder name cannot contain more than 100 characters.": "フォルダー名は 100 文字を超えることはできません。",
107106
"The item could not be added to My Favorites.": "アイテムをお気に入りに追加できませんでした。",
108107
"The item could not be removed from My Favorites.": "アイテムをお気に入りから削除できませんでした。",
109108
"The notebook file does not contain any code to convert.": "ノートブックファイルには、変換するコードが含まれていません。",

l10n/bundle.l10n.ko.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "작업이 완료되었습니다.",
104104
"The SAS session has closed.": "SAS 세션이 종료되었습니다.",
105105
"The file type is unsupported.": "지원되지 않는 파일 형식입니다.",
106-
"The folder name cannot contain more than 100 characters.": "폴더 이름은 100자를 초과할 수 없습니다.",
107106
"The item could not be added to My Favorites.": "항목을 즐겨찾기에 추가할 수 없습니다.",
108107
"The item could not be removed from My Favorites.": "항목을 즐겨찾기에서 제거할 수 없습니다.",
109108
"The notebook file does not contain any code to convert.": "노트북 파일에 변환할 코드가 포함되어 있지 않습니다.",

l10n/bundle.l10n.pt-br.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "Tarefa completado.",
104104
"The SAS session has closed.": "A sessão de SAS foi encerrada.",
105105
"The file type is unsupported.": "Este tipo de arquivo não é compatível.",
106-
"The folder name cannot contain more than 100 characters.": "O nome da pasta não pode conter mais de 100 caracteres.",
107106
"The item could not be added to My Favorites.": "Não foi possível adicionar o iten a My Favorites.",
108107
"The item could not be removed from My Favorites.": "Não foi possível excluir o iten do My Favorites.",
109108
"The notebook file does not contain any code to convert.": "O arquivo notebook não contém nenhum código para converter.",

l10n/bundle.l10n.zh-cn.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"Task is complete.": "任务完成。",
104104
"The SAS session has closed.": "SAS会话已关闭。",
105105
"The file type is unsupported.": "不支持该文件类型。",
106-
"The folder name cannot contain more than 100 characters.": "文件夹名称不能超过100个字符。",
107106
"The item could not be added to My Favorites.": "该项目无法添加到我的收藏夹。",
108107
"The item could not be removed from My Favorites.": "无法从我的收藏夹中删除该项目。",
109108
"The notebook file does not contain any code to convert.": "笔记本文件不包含任何要转换的代码。",

0 commit comments

Comments
 (0)