@@ -121,8 +121,8 @@ public function getPeersForCall(): DataResponse {
121
121
*
122
122
* Required capability: `download-call-participants`
123
123
*
124
- * @param 'csv'|'pdf' $format Download format
125
- * @return DataDownloadResponse<Http::STATUS_OK, 'text/csv'|'application/pdf' , array{}>|Response<Http::STATUS_BAD_REQUEST, array{}>
124
+ * @param 'csv' $format Download format
125
+ * @return DataDownloadResponse<Http::STATUS_OK, 'text/csv', array{}>|Response<Http::STATUS_BAD_REQUEST, array{}>
126
126
*
127
127
* 200: List of participants in the call downloaded in the requested format
128
128
* 400: No call in progress
@@ -141,13 +141,8 @@ public function downloadParticipantsForCall(string $format = 'csv'): DataDownloa
141
141
return new Response (Http::STATUS_BAD_REQUEST );
142
142
}
143
143
144
- if ($ format !== 'csv ' && $ format !== 'pdf ' ) {
145
- // Unsupported format
146
- return new Response (Http::STATUS_BAD_REQUEST );
147
- }
148
-
149
144
if ($ format !== 'csv ' ) {
150
- // FIXME Remove once pdf was implemented.
145
+ // Unsupported format
151
146
return new Response (Http::STATUS_BAD_REQUEST );
152
147
}
153
148
@@ -166,12 +161,12 @@ public function downloadParticipantsForCall(string $format = 'csv'): DataDownloa
166
161
} elseif ($ participant ->getAttendee ()->getActorType () === Attendee::ACTOR_USERS ) {
167
162
$ email = $ this ->userManager ->get ($ participant ->getAttendee ()->getActorId ())?->getEMailAddress() ?? '' ;
168
163
}
169
- fputcsv ($ output , [
164
+ fputcsv ($ output , array_map ([ $ this , ' escapeFormulae ' ], [
170
165
$ participant ->getAttendee ()->getDisplayName (),
171
166
$ email ,
172
167
$ participant ->getAttendee ()->getActorType (),
173
168
$ participant ->getAttendee ()->getActorId (),
174
- ], escape: '' );
169
+ ]) , escape: '' );
175
170
}
176
171
177
172
fseek ($ output , 0 );
@@ -198,6 +193,13 @@ public function downloadParticipantsForCall(string $format = 'csv'): DataDownloa
198
193
return new DataDownloadResponse (stream_get_contents ($ output ), $ fileName , 'text/csv ' );
199
194
}
200
195
196
+ protected function escapeFormulae (string $ value ): string {
197
+ if (preg_match ('/^[=+\-@\t\r]/ ' , $ value )) {
198
+ return "' " . $ value ;
199
+ }
200
+ return $ value ;
201
+ }
202
+
201
203
/**
202
204
* Join a call
203
205
*
0 commit comments