mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
Allow dash in folder name
This commit is contained in:
parent
0e174c971b
commit
395376c76f
|
@ -41,7 +41,7 @@ class LocationHead(TextChoices):
|
||||||
COMMON = '/S'
|
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:
|
def validate_location(target: str) -> bool:
|
||||||
|
|
|
@ -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 '))
|
self.assertFalse(validate_location('/S/1 '))
|
||||||
self.assertFalse(validate_location('/S/1/2 /3'))
|
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('/P'))
|
||||||
self.assertTrue(validate_location('/L'))
|
self.assertTrue(validate_location('/L'))
|
||||||
self.assertTrue(validate_location('/U'))
|
self.assertTrue(validate_location('/U'))
|
||||||
self.assertTrue(validate_location('/S'))
|
self.assertTrue(validate_location('/S'))
|
||||||
self.assertTrue(validate_location('/S/1'))
|
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'))
|
||||||
self.assertTrue(validate_location('/S/12/3'))
|
self.assertTrue(validate_location('/S/12/3'))
|
||||||
self.assertTrue(validate_location('/S/Вася пупки'))
|
self.assertTrue(validate_location('/S/Вася шофер'))
|
||||||
self.assertTrue(validate_location('/S/1/!asdf/тест тест'))
|
self.assertTrue(validate_location('/S/1/!asdf/тест тест'))
|
||||||
|
|
|
@ -452,7 +452,7 @@ def create_rsform(request: Request):
|
||||||
if 'file' not in request.FILES:
|
if 'file' not in request.FILES:
|
||||||
return Response(
|
return Response(
|
||||||
status=c.HTTP_400_BAD_REQUEST,
|
status=c.HTTP_400_BAD_REQUEST,
|
||||||
data={f'file': msg.missingFile()}
|
data={'file': msg.missingFile()}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
data = utils.read_zipped_json(request.FILES['file'].file, utils.EXTEOR_INNER_FILENAME)
|
data = utils.read_zipped_json(request.FILES['file'].file, utils.EXTEOR_INNER_FILENAME)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { TextMatcher } from '@/utils/utils';
|
||||||
|
|
||||||
import { ILibraryItem } from './library';
|
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.
|
* Checks if a given target {@link ILibraryItem} matches the specified query.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user