fix: admin/options: empty mime column for 'auto'

Massimo Melina committed May 14, 2024 at 21:59 UTC d852e9808b0adb233a2f12111e0983a5eb1b348b
1 file changed +2 -4
admin/src/OptionsPage.ts
+2 -4
@@ -202,12 +202,10 @@ export default function OptionsPage() {
202 color: 'warning.main', ml: 1
203 }))
204 } },
205 - { k: 'v', label: "Mime type", placeholder: "auto", $width: 2,
206 - toField: (x: any) => x === 'auto' ? '' : x, fromField: (x: string) => !x ? 'auto' : x.toLowerCase(),
207 - helperText: "Leave empty to get automatic value", },
205 + { k: 'v', label: "Mime type", placeholder: "auto", $width: 2, helperText: "Leave empty to get automatic value" },
206 ],
207 toField: x => Object.entries(x || {}).map(([k,v]) => ({ k, v })),
210 - fromField: x => Object.fromEntries(x.map((row: any) => [row.k, row.v])),
208 + fromField: x => Object.fromEntries(x.map((row: any) => [row.k, row.v || 'auto'])),
209 },
210 { k: 'server_code', comp: TextEditorField, sm: 12, getError: v => try_(() => new Function(v) && null, e => e.message),
211 helperText: md(`This code works similarly to [a plugin](${REPO_URL}blob/main/dev-plugins.md) (with some limitations)`)