Skip to content

Commit d8b1add

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
fix(calls): Fix displayname when exporting call participants
Signed-off-by: Joas Schilling <[email protected]>
1 parent 39d973d commit d8b1add

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

lib/Controller/CallController.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ public function downloadParticipantsForCall(string $format = 'csv'): DataDownloa
166166
} elseif ($participant->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
167167
$email = $this->userManager->get($participant->getAttendee()->getActorId())?->getEMailAddress() ?? '';
168168
}
169-
fputcsv($output, [
169+
fputcsv($output, array_map([$this, 'escapeFormulae'], [
170170
$participant->getAttendee()->getDisplayName(),
171171
$email,
172172
$participant->getAttendee()->getActorType(),
173173
$participant->getAttendee()->getActorId(),
174-
], escape: '');
174+
]), escape: '');
175175
}
176176

177177
fseek($output, 0);
@@ -198,6 +198,13 @@ public function downloadParticipantsForCall(string $format = 'csv'): DataDownloa
198198
return new DataDownloadResponse(stream_get_contents($output), $fileName, 'text/csv');
199199
}
200200

201+
protected function escapeFormulae(string $value): string {
202+
if (preg_match('/^[=+\-@\t\r]/', $value)) {
203+
return "'" . $value;
204+
}
205+
return $value;
206+
}
207+
201208
/**
202209
* Join a call
203210
*

tests/integration/features/callapi/public.feature

+3-2
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,18 @@ Feature: callapi/public
9595
And user "guest" joins call "room" with 200 (v4)
9696
Then user "participant1" sees 2 peers in call "room" with 200 (v4)
9797
And user "guest" sees 2 peers in call "room" with 200 (v4)
98+
And guest "guest" sets name to "=1+1" in room "room" with 200 (v1)
9899
And invoking occ with "user:setting participant1 settings email [email protected]"
99100
And user "participant2" downloads call participants from "room" as "csv" with 403 (v4)
100101
And user "participant1" downloads call participants from "room" as "csv" with 200 (v4)
101102
| name | email | type | identifier |
102103
| participant1-displayname | participant1@example.tld | users | participant1 |
103-
| | | guests | guest1 |
104+
| '=1+1 | | guests | guest1 |
104105
Then user "guest" leaves call "room" with 200 (v4)
105106
And user "participant1" downloads call participants from "room" as "csv" with 200 (v4)
106107
| name | email | type | identifier |
107108
| participant1-displayname | participant1@example.tld | users | participant1 |
108-
| | | guests | guest1 |
109+
| '=1+1 | | guests | guest1 |
109110
And invoking occ with "user:setting participant1 settings email --delete"
110111
Then user "participant1" sees 1 peers in call "room" with 200 (v4)
111112
And user "guest" sees 1 peers in call "room" with 200 (v4)

0 commit comments

Comments
 (0)