test(import): add regression tests for leading-dot and spaced filenames
Documents that .hidden.pdf and "Brief an Oma.pdf" correctly pass the isValidImportFilename guard — both are valid basenames common in the archive. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -512,6 +512,18 @@ class MassImportServiceTest {
|
|||||||
assertThat(result).isFalse();
|
assertThat(result).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void isValidImportFilename_returnsTrue_whenFilenameHasLeadingDot() {
|
||||||
|
boolean result = ReflectionTestUtils.invokeMethod(service, "isValidImportFilename", ".hidden.pdf");
|
||||||
|
assertThat(result).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void isValidImportFilename_returnsTrue_whenFilenameHasSpaces() {
|
||||||
|
boolean result = ReflectionTestUtils.invokeMethod(service, "isValidImportFilename", "Brief an Oma.pdf");
|
||||||
|
assertThat(result).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void processRows_skipsRowAndContinues_whenFilenameIsPathTraversal() {
|
void processRows_skipsRowAndContinues_whenFilenameIsPathTraversal() {
|
||||||
when(documentService.findByOriginalFilename("legitimate.pdf")).thenReturn(Optional.empty());
|
when(documentService.findByOriginalFilename("legitimate.pdf")).thenReturn(Optional.empty());
|
||||||
|
|||||||
Reference in New Issue
Block a user