Skip to content

Commit

Permalink
restrict to standard mimetype ids, improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperrealist authored and danielballan committed Apr 23, 2024
1 parent b054ce2 commit 3bdfe03
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions tiled/server/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,23 +1386,14 @@ async def patch_metadata(
detail="This node does not support update of metadata.",
)

if body.content_type in [
"application/json-patch+json",
"json-patch",
"jsonpatch",
]:
if body.content_type == "application/json-patch+json":
metadata = apply_json_patch(entry.metadata(), (body.patch or []))
elif body.content_type in [
"application/merge-patch+json",
"merge-patch",
"json-merge-patch",
"merge",
]:
elif body.content_type == "application/merge-patch+json":
metadata = apply_merge_patch(entry.metadata(), (body.patch or {}))
else:
raise HTTPException(
status_code=HTTP_406_NOT_ACCEPTABLE,
detail="application/json-patch+json or application/merge-patch+json expected.",
detail="application/json-patch+json or application/merge-patch+json content type expected.",
)

structure_family, structure, specs = (
Expand Down

0 comments on commit 3bdfe03

Please sign in to comment.