Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
fix: Set all rich object parameter values to string
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Apr 6, 2024
commit 338e811dae3c0b618c3b986555826e64e0948a43
8 changes: 4 additions & 4 deletions lib/Chat/Parser/SystemMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,11 +800,11 @@ protected function getFileFromShare(?Participant $participant, string $shareId):
'type' => 'file',
'id' => (string) $fileId,
'name' => $name,
'size' => $size,
'size' => (string) $size,
'path' => $path,
'link' => $url,
'etag' => $node->getEtag(),
'permissions' => $node->getPermissions(),
'permissions' => (string) $node->getPermissions(),
'mimetype' => $node->getMimeType(),
'preview-available' => $isPreviewAvailable ? 'yes' : 'no',
];
Expand All @@ -814,8 +814,8 @@ protected function getFileFromShare(?Participant $participant, string $shareId):
try {
$sizeMetadata = $this->metadataCache->getMetadataPhotosSizeForFileId($fileId);
if (isset($sizeMetadata['width'], $sizeMetadata['height'])) {
$data['width'] = $sizeMetadata['width'];
$data['height'] = $sizeMetadata['height'];
$data['width'] = (string) $sizeMetadata['width'];
$data['height'] = (string) $sizeMetadata['height'];
}
} catch (FilesMetadataNotFoundException) {
}
Expand Down
6 changes: 3 additions & 3 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ export type Participant = components['schemas']['Participant']
export type Mention = RichObject<'server'|'call-type'|'icon-url'>
export type File = RichObject<'size'|'path'|'link'|'mimetype'|'preview-available'> & {
'etag': string,
'permissions': number,
'width': number,
'height': number,
'permissions': string,
'width': string,
'height': string,
}
export type ChatMessage = components['schemas']['ChatMessageWithParent']
export type receiveMessagesParams = ApiOptions<operations['chat-receive-messages']['parameters']['query']>['params']
Expand Down
16 changes: 8 additions & 8 deletions tests/php/Chat/Parser/SystemMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -679,15 +679,15 @@ public function testGetFileFromShareForGuest() {
'type' => 'file',
'id' => '54',
'name' => 'name',
'size' => 65530,
'size' => '65530',
'path' => 'name',
'link' => 'absolute-link',
'etag' => '1872ade88f3013edeb33decd74a4f947',
'permissions' => 27,
'permissions' => '27',
'mimetype' => 'image/png',
'preview-available' => 'yes',
'width' => 1234,
'height' => 4567,
'width' => '1234',
'height' => '4567',
], self::invokePrivate($parser, 'getFileFromShare', [$participant, '23']));
}

Expand Down Expand Up @@ -760,11 +760,11 @@ public function testGetFileFromShareForOwner() {
'type' => 'file',
'id' => '54',
'name' => 'name',
'size' => 65520,
'size' => '65520',
'path' => 'path/to/file/name',
'link' => 'absolute-link-owner',
'etag' => '1872ade88f3013edeb33decd74a4f947',
'permissions' => 27,
'permissions' => '27',
'mimetype' => 'httpd/unix-directory',
'preview-available' => 'no',
], self::invokePrivate($parser, 'getFileFromShare', [$participant, '23']));
Expand Down Expand Up @@ -847,11 +847,11 @@ public function testGetFileFromShareForRecipient() {
'type' => 'file',
'id' => '54',
'name' => 'different',
'size' => 65515,
'size' => '65515',
'path' => 'Shared/different',
'link' => 'absolute-link-owner',
'etag' => '1872ade88f3013edeb33decd74a4f947',
'permissions' => 27,
'permissions' => '27',
'mimetype' => 'application/octet-stream',
'preview-available' => 'no',
], self::invokePrivate($parser, 'getFileFromShare', [$participant, '23']));
Expand Down