Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ public function renameRoom(string $roomName): DataResponse {

$roomName = trim($roomName);

if ($roomName === '' || strlen($roomName) > 200) {
if ($roomName === '' || strlen($roomName) > 255) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Service/RoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function createOneToOneConversation(IUser $actor, IUser $targetUser): Roo
*/
public function createConversation(int $type, string $name, ?IUser $owner = null, string $objectType = '', string $objectId = ''): Room {
$name = trim($name);
if ($name === '' || isset($name[255])) {
if ($name === '' || strlen($name) > 255) {
throw new InvalidArgumentException('name');
}

Expand Down
15 changes: 15 additions & 0 deletions tests/integration/features/chat/public.feature
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,18 @@ Feature: chat/public
| public room | guests | guest | | Message 3 | [] |
| public room | users | participant2 | participant2-displayname | Message 2 | [] |
| public room | users | participant1 | participant1-displayname | Message 1 | [] |


Scenario: Create room with big name and rename
# 260 chars
When user "participant1" creates room "public room" with 400 (v4)
| roomType | 3 |
| roomName | A name with 260 chars 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678 |
# 255 chars
And user "participant1" creates room "public room" (v4)
| roomType | 3 |
| roomName | A name with 255 chars 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123 |
# 260 chars
And user "participant1" renames room "public room" to "A name with 260 chars 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12345678" with 400 (v4)
# 255 chars
And user "participant1" renames room "public room" to "Another name with 255 chars 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 1234567" with 200 (v4)
1 change: 1 addition & 0 deletions tests/php/Service/RoomServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public function dataCreateConversationInvalidNames(): array {
[''],
[' '],
[str_repeat('a', 256)],
[str_repeat('😃', 200)],
];
}

Expand Down