Allow dash in folder name

This commit is contained in:
IRBorisov 2024-06-04 11:26:20 +03:00
parent 0e174c971b
commit 395376c76f
4 changed files with 8 additions and 4 deletions

View File

@ -41,7 +41,7 @@ class LocationHead(TextChoices):
COMMON = '/S'
_RE_LOCATION = r'^/[PLUS]((/[!\d\w]([!\d\w ]*[!\d\w])?)*)?$' # cspell:disable-line
_RE_LOCATION = r'^/[PLUS]((/[!\d\w]([!\d\w\- ]*[!\d\w])?)*)?$' # cspell:disable-line
def validate_location(target: str) -> bool:

View File

@ -87,13 +87,17 @@ class TestLocation(TestCase):
self.assertFalse(validate_location('/S/1/'))
self.assertFalse(validate_location('/S/1 '))
self.assertFalse(validate_location('/S/1/2 /3'))
self.assertFalse(validate_location('/S/-'))
self.assertFalse(validate_location('/S/1-'))
self.assertTrue(validate_location('/P'))
self.assertTrue(validate_location('/L'))
self.assertTrue(validate_location('/U'))
self.assertTrue(validate_location('/S'))
self.assertTrue(validate_location('/S/1'))
self.assertTrue(validate_location('/S/1-2'))
self.assertTrue(validate_location('/S/20210101 asdf-a/2'))
self.assertTrue(validate_location('/S/12'))
self.assertTrue(validate_location('/S/12/3'))
self.assertTrue(validate_location('/S/Вася пупки'))
self.assertTrue(validate_location('/S/Вася шофер'))
self.assertTrue(validate_location('/S/1/!asdf/тест тест'))

View File

@ -452,7 +452,7 @@ def create_rsform(request: Request):
if 'file' not in request.FILES:
return Response(
status=c.HTTP_400_BAD_REQUEST,
data={f'file': msg.missingFile()}
data={'file': msg.missingFile()}
)
else:
data = utils.read_zipped_json(request.FILES['file'].file, utils.EXTEOR_INNER_FILENAME)

View File

@ -7,7 +7,7 @@ import { TextMatcher } from '@/utils/utils';
import { ILibraryItem } from './library';
const LOCATION_REGEXP = /^\/[PLUS]((\/[!\d\p{L}]([!\d\p{L} ]*[!\d\p{L}])?)*)?$/u; // cspell:disable-line
const LOCATION_REGEXP = /^\/[PLUS]((\/[!\d\p{L}]([!\d\p{L}\- ]*[!\d\p{L}])?)*)?$/u; // cspell:disable-line
/**
* Checks if a given target {@link ILibraryItem} matches the specified query.