Skip to content

Commit

Permalink
fixes #146: Limit URI template match for MUC affiliation
Browse files Browse the repository at this point in the history
The fix for issue #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.
  • Loading branch information
guusdk committed Aug 4, 2022
1 parent 8444099 commit 8e525c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ <h1>
REST API Plugin Changelog
</h1>

<p><b>1.9.1</b> (tbd)</p>
<ul>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/146'>#146</a>] - Chatroom 'affiliation' URL template clash</li>
</ul>

<p><b>1.9.0</b> August 4, 2022</p>
<ul>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/141'>#141</a>] - Remove boilerplate code for managing MUC room affiliations</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.List;
import java.util.stream.Collectors;

@Path("restapi/v1/chatrooms/{roomName}/{affiliation}")
@Path("restapi/v1/chatrooms/{roomName}/{affiliation: (admins|members|outcasts|owners)}")
@Tag(name = "Chat room", description = "Managing Multi-User chat rooms.")
public class MUCRoomAffiliationsService
{
Expand Down

0 comments on commit 8e525c4

Please sign in to comment.