diff --git a/package-lock.json b/package-lock.json index d892c07a7..65e6e147a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3239,7 +3239,7 @@ "node_modules/@internxt/drive-desktop-core": { "version": "0.1.13", "resolved": "file:packages/core/internxt-drive-desktop-core-0.1.13.tgz", - "integrity": "sha512-Jm2143Zx0LthHmjzCddmX2gj4zkXtBgJfBlYvuh391h5jxPzarpB1HOWG5qkASIgsBqPa3hnYgLd7YzEcxv1eg==", + "integrity": "sha512-P1i557PM/UceEvDkDN+TlM4BXTL6dkfnAPpQkNVp3JenrGBl/fkq0hUwpVCmQexMOp3pRIIRo5g7Vp4cQ5Lqew==", "license": "MIT", "dependencies": { "@internxt/sdk": "^1.11.10", diff --git a/packages/core/internxt-drive-desktop-core-0.1.13.tgz b/packages/core/internxt-drive-desktop-core-0.1.13.tgz index 7953978bd..7345db362 100644 Binary files a/packages/core/internxt-drive-desktop-core-0.1.13.tgz and b/packages/core/internxt-drive-desktop-core-0.1.13.tgz differ diff --git a/packages/core/src/frontend/core/i18n/locales/en.ts b/packages/core/src/frontend/core/i18n/locales/en.ts index 70f1b940f..e42a6319d 100644 --- a/packages/core/src/frontend/core/i18n/locales/en.ts +++ b/packages/core/src/frontend/core/i18n/locales/en.ts @@ -390,7 +390,7 @@ export const en = { FILE_SIZE_TOO_BIG: 'File size too big (max 40GB)', FOLDER_ACCESS_DENIED: 'The app does not have permission to access this folder', FOLDER_DOES_NOT_EXIST: 'Folder does not exist', - INVALID_WINDOWS_NAME: String.raw`Windows does not allow names that include the characters \ / : * ? " < > |`, + INVALID_WINDOWS_NAME: String.raw`Windows does not allow names that include \ / : * ? " < > | or start/end with spaces`, NETWORK_CONNECTIVITY_ERROR: 'Network connectivity error.', NOT_ENOUGH_SPACE: 'You have not enough space to complete the operation', PARENT_FOLDER_DOES_NOT_EXIST: 'Parent folder does not exist', diff --git a/packages/core/src/frontend/core/i18n/locales/es.ts b/packages/core/src/frontend/core/i18n/locales/es.ts index 5e16f7f36..e03a3b8d3 100644 --- a/packages/core/src/frontend/core/i18n/locales/es.ts +++ b/packages/core/src/frontend/core/i18n/locales/es.ts @@ -394,7 +394,7 @@ export const es: Translation = { FILE_SIZE_TOO_BIG: 'Archivo es demasiado grande (máximo 40GB)', FOLDER_ACCESS_DENIED: 'La app no tiene permiso para acceder a esta carpeta', FOLDER_DOES_NOT_EXIST: 'Carpeta no existe', - INVALID_WINDOWS_NAME: String.raw`Windows no permite nombres que incluyen los caracteres \ / : * ? " < > |`, + INVALID_WINDOWS_NAME: String.raw`Windows no permite nombres que incluyan \ / : * ? " < > | o que comiencen/terminen con espacios`, NETWORK_CONNECTIVITY_ERROR: 'Error de conectividad de red', NOT_ENOUGH_SPACE: 'No tienes suficiente espacio para completar la operación', PARENT_FOLDER_DOES_NOT_EXIST: 'Carpeta padre no existe', diff --git a/packages/core/src/frontend/core/i18n/locales/fr.ts b/packages/core/src/frontend/core/i18n/locales/fr.ts index 715b4b807..77d1edaf3 100644 --- a/packages/core/src/frontend/core/i18n/locales/fr.ts +++ b/packages/core/src/frontend/core/i18n/locales/fr.ts @@ -395,7 +395,7 @@ export const fr: Translation = { FILE_SIZE_TOO_BIG: 'Le fichier est trop grand (max 40GB)', FOLDER_ACCESS_DENIED: "L'app n'a pas le droit d'accéder à cette dossier", FOLDER_DOES_NOT_EXIST: 'Dossier non existant', - INVALID_WINDOWS_NAME: String.raw`Windows ne permet pas les noms contenant les caractères \ / : * ? " < > |`, + INVALID_WINDOWS_NAME: String.raw`Windows ne permet pas les noms contenant \ / : * ? " < > | ou commençant/terminant par des espaces`, NETWORK_CONNECTIVITY_ERROR: 'Erreur de connectivité réseau', NOT_ENOUGH_SPACE: "Vous n'avez pas assez d'espace pour compléter l'opération", PARENT_FOLDER_DOES_NOT_EXIST: 'Dossier parent non existant', diff --git a/src/context/virtual-drive/items/validate-windows-name.test.ts b/src/context/virtual-drive/items/validate-windows-name.test.ts index 0f2ea8c31..542c4eae1 100644 --- a/src/context/virtual-drive/items/validate-windows-name.test.ts +++ b/src/context/virtual-drive/items/validate-windows-name.test.ts @@ -9,53 +9,63 @@ describe('validate-windows-name', () => { return mockProps({ name }); } - it('Should return true when the name is valid', () => { + it('should return true when the name is valid', () => { const result = validateWindowsName(getProps({ name: 'test' })); expect(result.isValid).toBe(true); }); - it('Should return false when the name includes \\', () => { + it('should return false when the name includes \\', () => { const result = validateWindowsName(getProps({ name: '\\test' })); expect(result.isValid).toBe(false); }); - it('Should return false when the name includes /', () => { + it('should return false when the name includes /', () => { const result = validateWindowsName(getProps({ name: '/test' })); expect(result.isValid).toBe(false); }); - it('Should return false when the name includes :', () => { + it('should return false when the name includes :', () => { const result = validateWindowsName(getProps({ name: ':test' })); expect(result.isValid).toBe(false); }); - it('Should return false when the name includes *', () => { + it('should return false when the name includes *', () => { const result = validateWindowsName(getProps({ name: '*test' })); expect(result.isValid).toBe(false); }); - it('Should return false when the name includes ?', () => { + it('should return false when the name includes ?', () => { const result = validateWindowsName(getProps({ name: '?test' })); expect(result.isValid).toBe(false); }); - it('Should return false when the name includes "', () => { + it('should return false when the name includes "', () => { const result = validateWindowsName(getProps({ name: '"test' })); expect(result.isValid).toBe(false); }); - it('Should return false when the name includes <', () => { + it('should return false when the name includes <', () => { const result = validateWindowsName(getProps({ name: '', () => { + it('should return false when the name includes >', () => { const result = validateWindowsName(getProps({ name: '>test' })); expect(result.isValid).toBe(false); }); - it('Should return false when the name includes |', () => { + it('should return false when the name includes |', () => { const result = validateWindowsName(getProps({ name: '|test' })); expect(result.isValid).toBe(false); }); + + it('should return false when the name starts with empty space', () => { + const result = validateWindowsName(getProps({ name: ' test' })); + expect(result.isValid).toBe(false); + }); + + it('should return false when the name ends with empty space', () => { + const result = validateWindowsName(getProps({ name: 'test ' })); + expect(result.isValid).toBe(false); + }); }); diff --git a/src/context/virtual-drive/items/validate-windows-name.ts b/src/context/virtual-drive/items/validate-windows-name.ts index 63cfe2142..cb1fb27f6 100644 --- a/src/context/virtual-drive/items/validate-windows-name.ts +++ b/src/context/virtual-drive/items/validate-windows-name.ts @@ -11,7 +11,7 @@ export function validateWindowsName({ path, name }: TProps) { * v2.5.3 Daniel Jiménez * These characters are invalid in windows paths. */ - const forbiddenPattern = /[<>:"/\\|?*]/; + const forbiddenPattern = /[<>:"/\\|?*]|^\s|\s$/; const isValid = !forbiddenPattern.test(name); if (!isValid) {