Repository navigation
Commit 8bcd08d
committed
fix(start-static-server-functions): treat a wrongly shaped payload as a miss
Decoding can succeed for a payload that is not a cached result, for instance a
seroval encoded plain string left at the cache path by another build step. Such
a value is truthy, so the caller took it for a hit, skipped the server function
and handed back an undefined result.
Require the decoded value to be an object carrying both `result` and `context`
before accepting it. `addItemToCache` always writes both keys and seroval keeps
them even when the context is undefined, so a genuine hit is unaffected.
Plain JSON that is not seroval encoded already threw inside `fromJSON` and was
caught, so only the valid-seroval-wrong-shape case needed the check.1 parent e5c9d7d commit 8bcd08d
2 files changed
Lines changed: 44 additions & 0 deletions
File tree
- packages/start-static-server-functions
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
163 | 178 | | |
164 | 179 | | |
165 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
100 | 129 | | |
101 | 130 | | |
102 | 131 | | |
| |||
0 commit comments