mirror of
https://github.com/brunopostle/ifcurl.git
synced 2026-07-12 02:08:13 +00:00
Enforce spec: validate query dot notation, improve tooltip
service.py: return 400 with a clear message when query= looks like a bare property set name (starts with Pset_ or Qto_ but has no dot). Catches the common mistake of writing Pset_WallCommon instead of Pset_WallCommon.FireRating, giving feedback instead of silent empty results. viewer.html: update query input placeholder and title to show the expected formats (Name, Description for attributes; Pset_X.Prop for property sets). https://claude.ai/code/session_01NBsytCd6L7UQPiKbcLn4kn
This commit is contained in:
parent
7e7aadeb5a
commit
2e30fffa62
2 changed files with 14 additions and 2 deletions
|
|
@ -224,8 +224,8 @@
|
|||
<div class="field" style="flex:2">
|
||||
<label>query</label>
|
||||
<input id="query-input" class="ti" type="text"
|
||||
placeholder="Name or Pset.Property"
|
||||
title="Attribute or property set value to retrieve for each selected element"
|
||||
placeholder="Name or Pset_X.Property"
|
||||
title="Direct IFC attribute: Name, Description. Property set (dot notation required): Pset_WallCommon.FireRating, Qto_WallBaseQuantities.NetVolume"
|
||||
spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -787,6 +787,18 @@ def query(request: QueryRequest) -> JSONResponse:
|
|||
if not ifc_url.query:
|
||||
raise HTTPException(status_code=400, detail="URL has no 'query' parameter")
|
||||
|
||||
query_path = ifc_url.query
|
||||
if "." not in query_path and (
|
||||
query_path.startswith("Pset_") or query_path.startswith("Qto_")
|
||||
):
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=(
|
||||
f"'query={query_path}' looks like a property set name — "
|
||||
f"use dot notation: '{query_path}.PropertyName'"
|
||||
),
|
||||
)
|
||||
|
||||
_ssrf_check(ifc_url)
|
||||
|
||||
token = request.token
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue