vishwask commited on
Commit
8f27bab
·
verified ·
1 Parent(s): aa0c7f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -155,7 +155,9 @@ def initialize_database(list_file_obj, chunk_size, chunk_overlap, progress=gr.Pr
155
  collection_name = collection_name.replace(" ","-")
156
  # Remove periods
157
  collection_name = collection_name.replace(".","_")
158
-
 
 
159
  ## Limit lenght to 50 characters
160
  collection_name = collection_name[:50]
161
  ## Enforce start and end as alphanumeric character
 
155
  collection_name = collection_name.replace(" ","-")
156
  # Remove periods
157
  collection_name = collection_name.replace(".","_")
158
+ octets = collection_name.split('.')
159
+ if len(octets) != 4 or any(not 0 <= int(octet) <= 255 for octet in octets):
160
+ print('ipv4 address') # Not a valid IPv4 address
161
  ## Limit lenght to 50 characters
162
  collection_name = collection_name[:50]
163
  ## Enforce start and end as alphanumeric character