Open aeberhart opened 7 months ago
postpone RA update
maybe replace table names containing space with _
we should remove the upload special handling once the underlying RA issue is fixed
react admin behaves as follows w.r.t. special characters in resource names:
RA useCreatePath:
return removeDoubleSlashes(
`${basename}/${resource}/${encodeURIComponent(id)}/show`
);
test code
const AdminApp = () => (
<Admin dataProvider={dataProvider}>
<Resource name="ö" list={LIST} edit={EDIT} />
<Resource name="a!b" list={LIST} edit={EDIT} />
<Resource name="a b" list={LIST} edit={EDIT} />
<Resource name="a/b" list={LIST} edit={EDIT} />
<Resource name="a%2Fb" list={LIST} edit={EDIT} />
<Resource name="a@b" list={LIST} edit={EDIT} />
<Resource name="a\b" list={LIST} edit={EDIT} />
<Resource name="a'b" list={LIST} edit={EDIT} />
<Resource name='a"b' list={LIST} edit={EDIT} />
<Resource name="a:b" list={LIST} edit={EDIT} />
<Resource name="a+b" list={LIST} edit={EDIT} />
<Resource name="a#b" list={LIST} edit={EDIT} />
<Resource name="a?b" list={LIST} edit={EDIT} />
<Resource name="a%b" list={LIST} edit={EDIT} />
<Resource name="a%23b" list={LIST} edit={EDIT} />
</Admin>
);
export const LIST = () => {
return <p>{useResourceContext()}</p>
}
export const EDIT = () => {
return <p>{useResourceContext() + ' - ' + useGetRecordId()}</p>
}
TODO still: special handling for tables that have # in their resource name
The issue only happens with " " (space) characters in the resource name. Other special characters work fine. In this case, react admin cannot map the browser route to the resource.
Just tested with the latest version of react-admin (4.16.11). The behaviour changed but was still buggy.
Asked in the RA admin discord of there were any rules for choosing / escaping resource names