Opened 7 years ago
Closed 5 years ago
#17628 closed defect (fixed)
JsonRest : string concatenation of a null query
Reported by: | gbranchaud | Owned by: | dylan |
---|---|---|---|
Priority: | low | Milestone: | 1.11 |
Component: | Data | Version: | 1.9.2 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I had issues with a JsonRest?-backed dgrid where upon sorting, the XHR request would come out as something like:
GET myserver.com/items/null?sort(+name)
Of course, I expected something like:
GET myserver.com/items/?sort(+name)
After investigation, I landed upon the query()
method of the dojo/store/JsonRest.js
file. The issue arises on line 176:
query += (query || hasQuestionMark ? "&" : "?") + (sortParam ? sortParam + '=' : "sort(");
In my case, query
is null. So the code basically does null + "?" + "sort(";
which results in the leading "null" string.
Since having a null query
object at this point is a valid behavior, I think this is a bug in the store implementation.
The proposed fix is simply to add a line in between line 175 & 176 that would initialize query
:
query = query || "";
Change History (3)
comment:1 Changed 5 years ago by
Component: | RPC → Data |
---|---|
Milestone: | tbd → 1.11 |
Owner: | set to dylan |
Status: | new → assigned |
comment:2 Changed 5 years ago by
Priority: | undecided → low |
---|
comment:3 Changed 5 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Landed as https://github.com/dojo/dojo/commit/81f846d7a0de94e323a0f5ab4624b26091c4bc03 . Not backporting as it is a subtle change in behavior, even though it's fixing it to be more sane. Thanks gbranchaud!
Will review this soon hopefully.