Commit 97d4eef
committed
Drop the uri encoding workaround instead of copying its TODO
An earlier commit here made UsageReportDataService skip encoding its uri param,
copying the workaround and the TODO that AuthorizationDataService carries:
// TODO fix encode the uri parameter in the self link in the backend and set
// encodeValue to true afterwards
Measured against a DSpace 9.1 backend, that TODO is based on a misreading - there
is nothing to fix in the backend. It does not decode the self link; it re-encodes
the parameter values minimally, and ':' and '/' are legal in a query component per
RFC 3986, so it has no reason to escape them:
sent probe=a%25b -> self probe=a%25b (not decoded)
sent probe=a%20b -> self probe=a%20b (not decoded)
sent probe=a+b -> self probe=a%20b ('+' is a space in form encoding)
sent uri=http%3A%2F%2Fx -> self uri=http://x
encodeURIComponent on the frontend simply encodes more than it has to. Both urls
are valid and denote the same value.
Since the comparison now decodes both sides, the encoding no longer matters, so
put the param back on the default: encoding is the safer choice for a value that
could contain '&' or '#'. Verified in a browser - the home page still logs no self
link warning with encoding restored.
The same workaround in AuthorizationDataService is left alone: it is upstream code,
it works either way, and it is out of scope here.1 parent a5f19fb commit 97d4eef
1 file changed
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
0 commit comments