Skip to content

Commit

Permalink
Merge pull request #92 from internetarchive/fix-semgrep
Browse files Browse the repository at this point in the history
Fix page suffix bug in validate ia_identifier
  • Loading branch information
cdrini authored Nov 26, 2024
2 parents f1faba2 + b0dbb6b commit 242a86e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions iiify/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def vtt_stream(identifier):
@app.route('/iiif/<identifier>/manifest.json')
@cache.cached(timeout=cache_timeouts["long"], forced_update=cache_bust)
def manifest(identifier):
validate_ia_identifier(identifier, page_suffix=True)
validate_ia_identifier(identifier, page_suffix=False)
return redirect(f'/iiif/3/{identifier}/manifest.json', code=302)

@app.route('/iiif/2/<identifier>/manifest.json')
Expand Down Expand Up @@ -279,8 +279,8 @@ def validate_ia_identifier(identifier: str, page_suffix: bool) -> None:
if page_suffix:
if not re.match(r'^[a-zA-Z0-9_.-]{1,100}(\$\d+)?$', identifier):
abort(400, "Invalid identifier")
return
return

if not re.match(r'^[a-zA-Z0-9_.-]{1,100}$', identifier):
abort(400, "Invalid identifier")
return
Expand Down

0 comments on commit 242a86e

Please sign in to comment.