Commit b13cdd7
Return empty feed instead of 204 from the DiscoJuice feeds endpoint (#1422)
* Return empty feed instead of 204 from the DiscoJuice feeds endpoint
When no discofeed content is cached — the default, since
`shibboleth.discofeed.allowed` is off — `/api/discojuice/feeds`
responded with `204 No Content`. The DiscoJuice IdP-discovery widget on
the login and register pages loads this endpoint via JSONP and passes
the body straight to `jQuery.merge()`. An empty body leaves the callback
argument undefined, so the widget throws
`TypeError: Cannot read properties of undefined (reading 'length')`
on every default deployment.
Respond with an empty but valid feed instead: `callback([])` when a
callback is given, `[]` otherwise. The JSONP callback then always fires
with a well-formed array and the widget no longer crashes; deployments
with feeds enabled are unaffected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* Shorten the empty-feed comment
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 2a1b41b commit b13cdd7
2 files changed
Lines changed: 31 additions & 7 deletions
File tree
- dspace-server-webapp/src
- main/java/org/dspace/app/rest/repository
- test/java/org/dspace/app/rest
Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
| |||
45 | 42 | | |
46 | 43 | | |
47 | 44 | | |
48 | | - | |
49 | | - | |
| 45 | + | |
50 | 46 | | |
51 | 47 | | |
52 | 48 | | |
53 | | - | |
54 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
55 | 52 | | |
56 | 53 | | |
57 | 54 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
111 | 138 | | |
0 commit comments