fix (fatal): edge case causing fatal issue

I've seen the case where someone ran out of disk with a corrupted config
file which gave the following fatal error in the login screen:

Uncaught TypeError: Cannot read properties of null (reading 'map')

with a stacktrace pointing to: ctrl_form.js:22:63

this fixes the assumptions on the config file so as to not trigger the
fatal error but head to the nicer error cases where it would say:

Internal Error: There is nothing here.

which is much nicer for end users than "Cannot read properties of null"
This commit is contained in:
MickaelK 2024-11-28 01:50:41 +11:00
parent 2914443789
commit 8303ae54f0

View file

@ -19,8 +19,8 @@ import backend$ from "./model_backend.js";
import { setCurrentBackend, getCurrentBackend, getURLParams } from "./ctrl_form_state.js";
const connections$ = config$.pipe(
rxjs.map(({ connections = [], auth = [] }) => connections.map((conn) => {
conn.middleware = auth.indexOf(conn.label) >= 0;
rxjs.map(({ connections, auth }) => (connections || []).map((conn) => {
conn.middleware = (auth || []).indexOf(conn.label) >= 0;
return conn;
})),
rxjs.shareReplay(1),