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

Chatroom 'affiliation' URL template clash #146

Closed
guusdk opened this issue Aug 4, 2022 · 0 comments
Closed

Chatroom 'affiliation' URL template clash #146

guusdk opened this issue Aug 4, 2022 · 0 comments

Comments

@guusdk
Copy link
Member

guusdk commented Aug 4, 2022

With #141, which was part of release 1.9.0, these endpoints (and their sub-resources):

  • /restapi/v1/chatrooms/{roomName}/owners
  • /restapi/v1/chatrooms/{roomName}/admins
  • /restapi/v1/chatrooms/{roomName}/members
  • /restapi/v1/chatrooms/{roomName}/outcasts

got replaced by one generic endpoint (and sub-resources):

  • /restapi/v1/chatrooms/{roomName}/{affiliation}

Sadly, this new template clashes with other, unrelated endpoints, including:

  • /restapi/v1/chatrooms/{roomName}/chathistory
  • /restapi/v1/chatrooms/{roomName}/occupants
  • /restapi/v1/chatrooms/{roomName}/participants
  • /restapi/v1/chatrooms/{roomName}/invite

The fix for #141 makes these return an 400 response, stating that chathistory, occupants, participants or invite is not a valid affiliation value.

guusdk added a commit to guusdk/openfire-restAPI-plugin that referenced this issue Aug 4, 2022
The fix for issue igniterealtime#141 introduces a template to replace four distinct URL patterns:
- `/restapi/v1/chatrooms/{roomName}/owners`
- `/restapi/v1/chatrooms/{roomName}/admins`
- `/restapi/v1/chatrooms/{roomName}/members`
- `/restapi/v1/chatrooms/{roomName}/outcasts`

got replaced by

- `/restapi/v1/chatrooms/{roomName}/{affiliation}`

Sadly, this template matches more than just those four. URLs like these also get caught, making them misbehave:

- `/restapi/v1/chatrooms/{roomName}/chathistory`
- `/restapi/v1/chatrooms/{roomName}/occupants`
- `/restapi/v1/chatrooms/{roomName}/participants`
- `/restapi/v1/chatrooms/{roomName}/invite`

This commit fixes the problem by applying a regular expression to the `{affiliation}` template, requiring it to match one of four distinct options.
guusdk added a commit to guusdk/openfire-restAPI-plugin that referenced this issue Aug 4, 2022
The fix for issue igniterealtime#141 introduces a template to replace four distinct URL patterns:
- `/restapi/v1/chatrooms/{roomName}/owners`
- `/restapi/v1/chatrooms/{roomName}/admins`
- `/restapi/v1/chatrooms/{roomName}/members`
- `/restapi/v1/chatrooms/{roomName}/outcasts`

got replaced by

- `/restapi/v1/chatrooms/{roomName}/{affiliation}`

Sadly, this template matches more than just those four. URLs like these also get caught, making them misbehave:

- `/restapi/v1/chatrooms/{roomName}/chathistory`
- `/restapi/v1/chatrooms/{roomName}/occupants`
- `/restapi/v1/chatrooms/{roomName}/participants`
- `/restapi/v1/chatrooms/{roomName}/invite`

This commit fixes the problem by applying a regular expression to the `{affiliation}` template, requiring it to match one of four distinct options.
@guusdk guusdk closed this as completed in 8e525c4 Aug 4, 2022
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