idolezal commited on
Commit
41fc211
1 Parent(s): ff6fff7

Check inputs["link_to_model"]

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -39,6 +39,8 @@ def validate_submission_inputs(**inputs):
39
  raise ValueError('Please fill in all fields')
40
  if not os.path.exists(inputs["submission_file"]):
41
  raise ValueError('File does not exist')
 
 
42
 
43
  def process_submission(*inputs):
44
  try:
@@ -47,7 +49,7 @@ def process_submission(*inputs):
47
  if key in ("team_name", "model_name"):
48
  inputs[key] = re.sub(r"""\s+""", " ", inputs[key]).strip()
49
  elif key in ("description", "link_to_model"):
50
- inputs[key] = inputs[key].strip() # TODO: u "link_to_model" kontrola funkčního URL
51
  validate_submission_inputs(**inputs)
52
  metadata = SUBMISSION_INPUTS - {"submission_file"}
53
  metadata = {key: inputs[key] for key in metadata}
 
39
  raise ValueError('Please fill in all fields')
40
  if not os.path.exists(inputs["submission_file"]):
41
  raise ValueError('File does not exist')
42
+ if not (inputs["link_to_model"].startswith("http://") or inputs["link_to_model"].startswith("https://")):
43
+ raise ValueError('Link does not starts with "http://" or "https://"')
44
 
45
  def process_submission(*inputs):
46
  try:
 
49
  if key in ("team_name", "model_name"):
50
  inputs[key] = re.sub(r"""\s+""", " ", inputs[key]).strip()
51
  elif key in ("description", "link_to_model"):
52
+ inputs[key] = inputs[key].strip()
53
  validate_submission_inputs(**inputs)
54
  metadata = SUBMISSION_INPUTS - {"submission_file"}
55
  metadata = {key: inputs[key] for key in metadata}