fix(files): Fix non-string values for activity rich object strings

Signed-off-by: provokateurin <kate@provokateurin.de>
pull/52658/head
provokateurin 2025-05-05 13:50:26 +07:00 committed by backportbot[bot]
parent 1402f6d6b8
commit 67e60d9711
2 changed files with 4 additions and 4 deletions

@ -319,7 +319,7 @@ class Provider implements IProvider {
protected function getFile($parameter, ?IEvent $event = null): array {
if (is_array($parameter)) {
$path = reset($parameter);
$id = (string)key($parameter);
$id = (int)key($parameter);
} elseif ($event !== null) {
// Legacy from before ownCloud 8.2
$path = $parameter;
@ -341,7 +341,7 @@ class Provider implements IProvider {
return [
'type' => 'file',
'id' => $encryptionContainer->getId(),
'id' => (string)$encryptionContainer->getId(),
'name' => $encryptionContainer->getName(),
'path' => $path,
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $encryptionContainer->getId()]),
@ -354,7 +354,7 @@ class Provider implements IProvider {
return [
'type' => 'file',
'id' => $id,
'id' => (string)$id,
'name' => basename($path),
'path' => trim($path, '/'),
'link' => $this->url->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $id]),

@ -93,7 +93,7 @@ class ProviderTest extends TestCase {
return [
[[42 => '/FortyTwo.txt'], null, '42', 'FortyTwo.txt', 'FortyTwo.txt'],
[['23' => '/Twenty/Three.txt'], null, '23', 'Three.txt', 'Twenty/Three.txt'],
['/Foo/Bar.txt', 128, 128, 'Bar.txt', 'Foo/Bar.txt'], // Legacy from ownCloud 8.2 and before
['/Foo/Bar.txt', 128, '128', 'Bar.txt', 'Foo/Bar.txt'], // Legacy from ownCloud 8.2 and before
];
}