diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-07-15 18:11:54 +0300 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-07-31 20:37:59 +0300 |
commit | 7b723813cef60e744ab14ab418c82e5ec67a9f2e (patch) | |
tree | eda4a044c9defc883c35d98e1ba5a9e261a3ecdf /lib/private/Share20/DefaultShareProvider.php | |
parent | ab1a20522b1b2730398869a764f672175a1abcb8 (diff) |
Multiple fixesenh/noid/share-attributes
- Fix tests
- Use non deprecated event stuff
- Add a bit of type hinting to the new stuff
- More safe handling of instanceOfStorage (share might not be the first
wrapper)
- Fix resharing
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib/private/Share20/DefaultShareProvider.php')
-rw-r--r-- | lib/private/Share20/DefaultShareProvider.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 627284da4e8..70f9b8665f9 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -1566,14 +1566,15 @@ class DefaultShareProvider implements IShareProvider { /** * Load from database format (JSON string) to IAttributes * - * @param IShare $share - * @param string|null $data - * @return IShare modified share + * @return IShare the modified share */ - private function updateShareAttributes(IShare $share, ?string $data) { + private function updateShareAttributes(IShare $share, ?string $data): IShare { if ($data !== null && $data !== '') { $attributes = new ShareAttributes(); $compressedAttributes = \json_decode($data, true); + if ($compressedAttributes === false || $compressedAttributes === null) { + return $share; + } foreach ($compressedAttributes as $compressedAttribute) { $attributes->setAttribute( $compressedAttribute[0], @@ -1589,11 +1590,8 @@ class DefaultShareProvider implements IShareProvider { /** * Format IAttributes to database format (JSON string) - * - * @param IAttributes|null $attributes - * @return string|null */ - private function formatShareAttributes($attributes) { + private function formatShareAttributes(?IAttributes $attributes): ?string { if ($attributes === null || empty($attributes->toArray())) { return null; } |