External storage encryption delete error #22598
External storage encryption delete error #22598dassio wants to merge 1 commit intonextcloud:masterfrom dassio:delete_ignore_encription_parameter
Conversation
kesselb
left a comment
There was a problem hiding this comment.
Nice catch!
getId is only available if $entry is a instance of CacheEntry. I would fix it like if ($entry instanceof CacheEntry) { but a storage expert should have a look because get should return a CacheEntry or false. An array with one or more keys is not documented.
lib/private/Files/Cache/Cache.php
Outdated
| $entry = $this->get($file); | ||
|
|
||
| // when deleting the entry, encrypted is not save in database, so we ignore it | ||
| unset($entry["encrypted"]); |
There was a problem hiding this comment.
| unset($entry["encrypted"]); | |
| unset($entry['encrypted']); |
Signed-off-by: xiangbin.li <dassio@icloud.com>
There should indeed not be an array returned. Would be interesting to know where that is coming from to fix that actually. While the unset might still work if false is returned I'd prefer to figure out the original source of the array and see why there is no CacheEntry returned. |
you can check the second track trace to see where this it is added by the encryption wrapper, so if encrtiption is not eabled, we will not have this issue |
There was a problem hiding this comment.
154 >->-$data = $query->execute()->fetch();
155
156 >->-//merge partial data
157 >->-if (!$data and is_string($file) and isset($this->partial[$file])) {
158 >->->-return $this->partial[$file];
159 >->-} elseif (!$data) {
160 >->->-return $data;
161 >->-} else {
162 >->->-return self::cacheEntryFromData($data, $this->mimetypeLoader);
163 >->-}
164 >-}
even though the query did not return anything, we still have the encrypted data from the encryption wrapper
|
/rebase |
fix issue caused by d3b6dbc
Error Message:
Analysis
File Upload
the metadata
encryptedis not savedFile Delete
when deleting file, 'encrypted' is added, so it pass condition check
if ($entry) {, result in the error