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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.route.discussion assumes discussion.tags() is loaded #170

Open
clarkwinkelmann opened this issue Dec 4, 2023 · 0 comments
Open

app.route.discussion assumes discussion.tags() is loaded #170

clarkwinkelmann opened this issue Dec 4, 2023 · 0 comments

Comments

@clarkwinkelmann
Copy link

This issue is based on a report on Discuss, but can be seen by simple static reading of the code.

if (discussionRedirectEnabled && discussion.tags().length > 0) {

The code that generates a link to a discussion reads `discussion.tags().length without checking that the relationship returns an array first, leading in errors "trying to read property of undefined".

I doubt this situation happens often, if at all, without additional third party extension, but the actual problematic extensions should be irrelevant, the code cannot assume the method returns an array and this would show errors if Typescript typings were enforced.

Reference https://discuss.flarum.org/d/33733-typeerror-etags-is-not-a-function/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant