Skip to content

Commit 14d252b

Browse files
authored
Merge pull request #360 from CanDIG/hotfix/escape-path
Hotfix: make sure that the queue_id is a uuid
2 parents 2fc4ae8 + 39fe5a1 commit 14d252b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

htsget_server/beacon_operations.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,11 @@ def add_to_queue(ingest_json):
319319

320320
@app.route('/beacon/v2/result/<path:queue_id>')
321321
def get_full_result(queue_id):
322+
uuid_match = re.match(r"^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$", queue_id)
323+
if uuid_match is None:
324+
return {"error": f"queue_id {queue_id} is not a UUID"}
322325
try:
323-
results_path = os.path.join(SEARCH_PATH, "results", queue_id)
326+
results_path = os.path.join(SEARCH_PATH, "results", uuid_match.group(0))
324327
with open(results_path) as f:
325328
json_data = json.load(f)
326329
# os.remove(results_path)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Flask==3.1.0
1+
Flask==3.1.1
22
Flask-Cors==5.0.0
33
minio==7.2.12
44
pysam==0.22.0

0 commit comments

Comments
 (0)