Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot view table with special characters #324

Open
aeberhart opened this issue Feb 24, 2024 · 7 comments
Open

Cannot view table with special characters #324

aeberhart opened this issue Feb 24, 2024 · 7 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@aeberhart
Copy link
Contributor

No description provided.

@aeberhart aeberhart added the bug Something isn't working label Feb 24, 2024
@aeberhart aeberhart added this to the 5.1 milestone Feb 24, 2024
@aeberhart
Copy link
Contributor Author

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
Copy link
Contributor Author

postpone RA update

maybe replace table names containing space with _

@aeberhart aeberhart removed this from the 5.1 milestone Mar 26, 2024
@aeberhart
Copy link
Contributor Author

we should remove the upload special handling once the underlying RA issue is fixed

@aeberhart aeberhart self-assigned this Apr 18, 2024
@aeberhart aeberhart added this to the 5.2 milestone Apr 18, 2024
@aeberhart
Copy link
Contributor Author

aeberhart commented May 16, 2024

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
Copy link
Contributor Author

RA useCreatePath:

                return removeDoubleSlashes(
                    `${basename}/${resource}/${encodeURIComponent(id)}/show`
                );

@aeberhart
Copy link
Contributor Author

aeberhart commented May 16, 2024

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
Copy link
Contributor Author

TODO still: special handling for tables that have # in their resource name

  • table FK references
  • links widget
  • handling of djLabel in those cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant