
| Key: |
LPP-4532
|
| Type: |
Bug
|
| Status: |
Closed
|
| Resolution: |
Fixed
|
| Priority: |
P1
|
| Assignee: |
Unassigned
|
| Reporter: |
André Bargull
|
| Votes: |
0
|
| Watchers: |
0
|
|
If you were logged in you would be able to see more operations.
|
|
|
| Severity: |
Minor
|
| Fixed in Change#: |
6,268
|
| Runtime: |
N/A
|
| Flags: |
External
|
| Fix in hand: |
True
|
|
"LzHTTPDatasource#doRequest(..)":
There's one obsolete if-clause, as "if (q.length > 0)" is always true, because "q" will have at minimum a length of "1".
[code]
var q = '?'
...
if (querystring != null && querystring.length > 0) {
if (q.length > 0) {
q += sep + querystring;
} else {
q = querystring;
}
}
...
[/code]
So we can say:
[code]
...
if (querystring != null && querystring.length > 0) {
q += sep + querystring;
}
...
[/code]
---
Second issue:
If we have got a question mark in the url, we must say "q.substring(1)", or else we'll have got two question marks in our final url, as "q" starts always with a question mark.
[code]
var q = '?';
...
var url = this.src
if (q == "?") {
// don't add empty args list
} else {
// if there are already query args in the url, separate them with a '&'
if (url.indexOf('?') >= 0) {
url = url + "&" + q;
} else {
url = url + q;
}
}
...
[/code]
So this should be:
[code]
...
var url = this.src
if (q == "?") {
// don't add empty args list
} else {
// if there are already query args in the url, separate them with a '&'
if (url.indexOf('?') >= 0) {
url = url + "&" + q.substring(1);
} else {
url = url + q;
}
}
...
[/code]
|
|
Description
|
"LzHTTPDatasource#doRequest(..)":
There's one obsolete if-clause, as "if (q.length > 0)" is always true, because "q" will have at minimum a length of "1".
[code]
var q = '?'
...
if (querystring != null && querystring.length > 0) {
if (q.length > 0) {
q += sep + querystring;
} else {
q = querystring;
}
}
...
[/code]
So we can say:
[code]
...
if (querystring != null && querystring.length > 0) {
q += sep + querystring;
}
...
[/code]
---
Second issue:
If we have got a question mark in the url, we must say "q.substring(1)", or else we'll have got two question marks in our final url, as "q" starts always with a question mark.
[code]
var q = '?';
...
var url = this.src
if (q == "?") {
// don't add empty args list
} else {
// if there are already query args in the url, separate them with a '&'
if (url.indexOf('?') >= 0) {
url = url + "&" + q;
} else {
url = url + q;
}
}
...
[/code]
So this should be:
[code]
...
var url = this.src
if (q == "?") {
// don't add empty args list
} else {
// if there are already query args in the url, separate them with a '&'
if (url.indexOf('?') >= 0) {
url = url + "&" + q.substring(1);
} else {
url = url + q;
}
}
...
[/code] |
Show » |
|