Commit b7e9b86
fix(self-link): say what happened when the API reduces a page size
ensureSelfLink() logs one wording for every self link that differs from the url
it was requested with, and that wording ends with "This could mean there's an
issue with the REST endpoint". For a page size the API reduced, that points at
the wrong place: the API did exactly what its contract says, the caller asked
for a bigger page than it will ever serve. Whoever reads the console goes
looking at the backend for a frontend mistake.
Give that case its own message:
The request for '.../bundles?size=9999' asked for a page of 9999 elements, but
the REST API served 1000. Ask for at most MAX_PAGE_SIZE elements
It applies only when the two urls are otherwise identical, so an accepted
reduction cannot mask a wrong page or sort. Anything else keeps the generic
message, including a page that came back larger than requested.
This is the remaining half of the fix on dtq-dev. #1415 landed the rest - embed
params and percent encoding normalized on both sides, MAX_PAGE_SIZE next to
FindListOptions, and every oversized call site brought within it - so a reduced
page size now genuinely means a caller asked for something the API was never
going to serve, and the message can say so.
- src/app/core/data/dspace-rest-response-parsing.service.ts - replace
isUnexpectedSelfLink() with selfLinkWarning(), which returns the message to
log or undefined when there is nothing to report, and add the
getPageSize()/withoutPageSize() helpers and the PAGE_SIZE_PARAM they match on.
The self link is normalized either way, as before, so the url a response is
cached under does not change - only whether and how we warn.
- src/app/core/data/dspace-rest-response-parsing.service.spec.ts - 17 cases to
19. The reduced page size case now expects the specific wording; one new case
pins that a reduced size is recognised alongside other params, another that a
page differing as well falls back to the generic message.
Adapted to 7.6 from DSpace/dspace-angular PR 6083, commit 887ddec. The
9.x-only parts of that commit's file - the @dspace/* path aliases and the
inject(APP_CONFIG) refactor - are deliberately left out, which is also why the
spec keeps its plain constructor harness instead of upstream's TestBed. Same
change as #1448, which went to customer/jcu only.
Fixes dataquest-dev/dspace-customers#934
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 914a688 commit b7e9b86
2 files changed
Lines changed: 64 additions & 23 deletions
File tree
- src/app/core/data
Lines changed: 21 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | | - | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 100 | + | |
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
108 | 124 | | |
109 | 125 | | |
110 | 126 | | |
111 | 127 | | |
112 | | - | |
| 128 | + | |
113 | 129 | | |
114 | 130 | | |
115 | 131 | | |
| |||
Lines changed: 43 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| |||
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
66 | | - | |
67 | | - | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
| |||
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
88 | 95 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
94 | 118 | | |
95 | 119 | | |
96 | 120 | | |
| |||
199 | 223 | | |
200 | 224 | | |
201 | 225 | | |
202 | | - | |
203 | | - | |
204 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
205 | 230 | | |
206 | 231 | | |
207 | 232 | | |
| |||
0 commit comments