Cannot view table with special characters
Opened this issue · 7 comments
aeberhart commented
Cannot view table with special characters
aeberhart commented
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
aeberhart commented
postpone RA update
maybe replace table names containing space with _
aeberhart commented
we should remove the upload special handling once the underlying RA issue is fixed
aeberhart commented
react admin behaves as follows w.r.t. special characters in resource names:
- / is not escaped - this conflicts with the DJ parsing logic though
- "hash" is escaped to %23, however the link to instance pages is broken because the hyperlink does not escape # (this is an issue in RA)
- % is escaped to %25, but the links are also broken
- ? does not work at all
- any other special character is escaped (for instance db/a b becomes db/a%20b)
aeberhart commented
RA useCreatePath:
return removeDoubleSlashes(
`${basename}/${resource}/${encodeURIComponent(id)}/show`
);
aeberhart commented
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>
}
aeberhart commented
TODO still: special handling for tables that have # in their resource name
- table FK references
- links widget
- handling of djLabel in those cases