clementsan
commited on
Commit
•
fa7cc51
1
Parent(s):
08108c1
Add alphanumeric checks for collection name
Browse files
app.py
CHANGED
@@ -198,6 +198,11 @@ def create_collection_name(filepath):
|
|
198 |
## Minimum length of 3 characters
|
199 |
if len(collection_name) < 3:
|
200 |
collection_name = collection_name + 'xyz'
|
|
|
|
|
|
|
|
|
|
|
201 |
print('Filepath: ', filepath)
|
202 |
print('Collection name: ', collection_name)
|
203 |
return collection_name
|
|
|
198 |
## Minimum length of 3 characters
|
199 |
if len(collection_name) < 3:
|
200 |
collection_name = collection_name + 'xyz'
|
201 |
+
## Enforce start and end as alphanumeric character
|
202 |
+
if not collection_name[0].isalnum():
|
203 |
+
collection_name[0] = 'A'
|
204 |
+
if not collection_name[-1].isalnum():
|
205 |
+
collection_name[-1] = 'Z'
|
206 |
print('Filepath: ', filepath)
|
207 |
print('Collection name: ', collection_name)
|
208 |
return collection_name
|