Skip to content

Commit

Permalink
Fix #6121 - use lower() on file types to validate (#6131)
Browse files Browse the repository at this point in the history
Co-authored-by: mkeilman <[email protected]>
  • Loading branch information
mkeilman and mkeilman authored Jul 19, 2023
1 parent 5fed2ea commit a6236c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sirepo/template/radia.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,15 @@ def save_field_srw(gap, vectors, beam_axis, filename):


def validate_file(file_type, path):
if path.ext not in (".csv", ".dat", ".stl", ".txt"):
p = path.ext.lower()
if p not in (".csv", ".dat", ".stl", ".txt"):
return f"invalid file type: {path.ext}"
if file_type == "extrudedPoints-pointsFile":
try:
_ = sirepo.csv.read_as_number_list(path)
except RuntimeError as e:
return e
if path.ext == ".stl":
if p == ".stl":
mesh = _create_stl_trimesh(path)
if trimesh.convex.is_convex(mesh) == False:
return f"not convex model: {path.basename}"
Expand Down

0 comments on commit a6236c2

Please sign in to comment.