Skip to content

[FIX] "Parent channel or group" search in discussions' creation throws "Unexpected end of JSON input" error#23076

Merged
matheusbsilva137 merged 8 commits intodevelopfrom
fix/number-sign-json
Sep 14, 2021
Merged

[FIX] "Parent channel or group" search in discussions' creation throws "Unexpected end of JSON input" error#23076
matheusbsilva137 merged 8 commits intodevelopfrom
fix/number-sign-json

Conversation

@matheusbsilva137
Copy link
Contributor

@matheusbsilva137 matheusbsilva137 commented Aug 31, 2021

Proposed changes (including videos or screenshots)

  • Use encodeURIComponent() to encode values received by _generateQueryFromParams().

Issue(s)

Task - ClickUp

Steps to test or reproduce

Open Create New Discussion and type "#" in the "Parent channel or group" field. Expected behavior: no error should be displayed (and the search's result should be empty).

Further comments

The JSON input would end before expected when using the "#" char because this could be interpreted as the URL's fragment part.

Copy link
Contributor

@tassoevan tassoevan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like theres a lot more to it than meets the eye. A private method on APIClient (_generateQueryFromParams to be more specific) is not encoding the values via encodeURIComponent(). so the # character is recognized as the start of the fragment part of the REST API's endpoint URL.

@matheusbsilva137 matheusbsilva137 merged commit 76ec9d2 into develop Sep 14, 2021
@matheusbsilva137 matheusbsilva137 deleted the fix/number-sign-json branch September 14, 2021 00:43
gabriellsh added a commit that referenced this pull request Sep 16, 2021
…to feat/seats-cap-banners

* 'feat/seats-cap' of github.com:RocketChat/Rocket.Chat:
  [NEW] Seats Cap: Request seats link (#23151)
  Regression: View Logs administration page crashing (#23205)
  Chore: Move client helpers (#23178)
  Chore: Change Ubuntu version to 20.04 on all GitHub Actions (#23200)
  Regression: Properly trickle-down state from UsersPage to UsersTable (#23196)
  [IMPROVE] Add missing pt-BR translations, fix typos and unify language (#23176)
  [FIX] User list not being updated after creation/deletion of user (#23032)
  Chore: Upgrade limax (#23187)
  [FIX] "Parent channel or group" search in discussions' creation throws "Unexpected end of JSON input" error (#23076)
  [BREAK] Stop sending audio notifications via stream (#23108)
  Language update from LingoHub 🤖 (#23184)
  [FIX] Remove margin from quote inside quote (#21779)
  [BREAK] Remove Google Vision features (#23160)
  Bump @storybook/react from 6.3.6 to 6.3.8 (#23165)
  Bump jsrsasign from 10.3.0 to 10.4.0 (#23163)
  [BREAK][ENTERPRISE] "Download CSV" button doesn't work in the Engagement Dashboard's Active Users section (#23013)
  [BREAK][ENTERPRISE] CSV file downloaded in the Engagement Dashboard's New Users section contains undefined data (#23014)
  Bump supertest from 6.1.3 to 6.1.6 (#23139)
@sampaiodiego sampaiodiego mentioned this pull request Oct 1, 2021
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

Successfully merging this pull request may close these issues.

2 participants

Comments