Fix infinite recursion when serializing object loops.
Review Request #6095 — Created July 10, 2014 and submitted
If two objects reference each other, and the relevant fields are listed in the
'expand' parameter, the serialization of the response would get a recursion
depthRuntimeError
and return 500. This manifested in Review Board using the
"Depends On" field, with two review requests that referenced each other.I've added some code to make each resource name in "expand" apply only once
for the entire serialization. This makes it possible to still expand deep into
object trees, but prevents infinite loops. To expand multiple levels with the
same resource name, it can be listed twice in 'expand'.
- Tested setting a review request's "Depends On" to itself.
- Tested a loop of two objects in "Depends On".
- Tested recursing multiple levels via:
curl /api/review-requests/1/?expand=depends_on,depends_on | python -mjson.tool
Description | From | Last Updated |
---|---|---|
can we change this to _djblets_webapi_expanded_resources? Been prefixing other Djblets things on request with similar prefixes. |
chipx86 |
- Commit:
-
9d1ed1f7f50697cabb493228055087800082ee11e0cec5ac0bf15e8e6a828a500cb2116b9f38d53b
- Diff:
-
Revision 2 (+13 -4)