Commit graph

282 commits

Author SHA1 Message Date
Robin Appelman
10b6d92319 fix: fix mimetype not being updated when changing file extention on object store
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-12-11 07:49:18 +00:00
Louis Chemineau
9f3d1b792c fix(files): Use isRetryable to catch retryable exceptions
Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-06-12 08:11:18 +00:00
Louis Chemineau
69bb0bf3e8 feat(files)): Add retry logic to cover deadlock situations when moving many files
Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-05-07 10:42:24 +02:00
Christoph Wurst
3de151521e fix(files): Don't attempt to format a partial cache entry
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-02-22 10:46:54 +01:00
Robin Appelman
6f7f52146f optimize cache jail creation
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-11-07 13:59:40 +00:00
Arthur Schiwon
96eca4a3ea fix(ci): update return type in php doc
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-10-11 14:41:43 +02:00
Robin Appelman
29c36f85b0 fix type hints
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-10-11 14:41:43 +02:00
Robin Appelman
0fde240089 fix unencrypted folder size when no children with unencrypted size set are left
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-10-11 14:41:43 +02:00
Robin Appelman
ed6606e86b fix unencrypted_size for files when scanning
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-10-11 14:41:43 +02:00
Robin Appelman
1a70ba6421 fix unencrypted_size for folders when scanning the filesystem with encryption enabled
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-10-11 14:41:43 +02:00
Julius Härtl
81f3ed25f0
fix: Only read unencrypted_size when file is actually encrypted
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-09-12 15:06:01 +02:00
Arthur Schiwon
f7d890cd66
Merge pull request #39726 from nextcloud/backport/39698/stable26
[stable26] Catch more invalid cache source storage paths
2023-09-05 18:59:48 +02:00
Andy Scherzinger
f3619d8558
Merge pull request #39872 from nextcloud/backport/38714/stable26
[stable26] select the fileid first when looking for incomplete files
2023-08-28 13:44:48 +02:00
Ferdinand Thiessen
15ea32c1e1 fix: Prevent PHP warnings when optional CacheEntry attributes are unset
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2023-08-17 10:03:53 +00:00
Robin Appelman
690d9bac5e select the fileid first when looking for incomplete files
this seems to improve mariadbs index selection

Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-08-14 19:15:41 +00:00
John Molakvoæ
fe85d7d05d fix: simplify sourceData check
Co-authored-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
2023-08-05 22:04:35 +00:00
Josh Richards
c4505160a0 Catch more invalid cache source storage paths
OC\Files\Cache\Cache::get can return string|false|null, not just string|false.

- nextcloud/server#26270 added handling of false, but null is needed too.
- Well, or we change the default $resullt to false, but I'm not sure if that has other ramifications and the real need here is to simply catch situations where the cache source storage path is not valid for whatever reason

Related: nextcloud/server#19009

Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
2023-08-05 22:04:35 +00:00
Arthur Schiwon
0b4db60d3b fix: include invisible tags for admins
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 14:54:56 +00:00
Arthur Schiwon
48c92ade85 fix: favorites view and universal search against tags
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 14:54:56 +00:00
Arthur Schiwon
c33f728249 fix: change if with conditionless else to switch; and a parameter value
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 14:54:55 +00:00
Arthur Schiwon
b172df69d6 use efficient tag retrieval on DAV report request
- uses DAV search approach against valid files joined by systemtag selector
- reduced table join for tag/systemtag search
- supports pagination
- no changes to the output formats or similar

Example request body:

<?xml version="1.0"?>
<oc:filter-files xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns" xmlns:ocs="http://open-collaboration-services.org/ns">
  <d:prop>
    <d:getcontentlength/>
    <d:getcontenttype/>
    <d:getetag/>
    <d:getlastmodified/>
    <d:resourcetype/>
    <nc:face-detections/>
    <nc:file-metadata-size/>
    <nc:has-preview/>
    <nc:realpath/>
    <oc:favorite/>
    <oc:fileid/>
    <oc:permissions/>
    <nc:nbItems/>
  </d:prop>
  <oc:filter-rules>
    <oc:systemtag>32</oc:systemtag>
  </oc:filter-rules>
  <d:limit>
    <d:nresults>50</d:nresults>
    <nc:firstresult>0</nc:firstresult>
  </d:limit>
</oc:filter-files>

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 14:54:55 +00:00
Arthur Schiwon
013d34977b
ci: adjust return annotation to older psalm version
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-26 17:07:21 +02:00
Arthur Schiwon
2b27a4cda0 refactor: declare getMount() and getMountsIn() at IRootFolder
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-23 23:04:44 +00:00
Arthur Schiwon
3813b955ee chore: ugly type juggling
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-23 23:04:40 +00:00
Arthur Schiwon
e095311819 fix: expect interface, not a specific implementation
- fixes a regression when deleting folders while music app was enabled,
  for a LazyRoot was passed to this method.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-06-23 23:04:39 +00:00
Julius Härtl
0a7594753f fix: execute throws docrine exceptions not our wrapped ones
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-05-26 07:46:25 +00:00
Arthur Schiwon
298af3cf0a
refactor: remove where specification from SELECT getter
- search constraints are now fully in control of
  SystemTagsInFilesDetector::detectAssignedSystemTagsIn(), avoids
  duplication of a WHERE statement

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-05-16 12:47:15 +02:00
Arthur Schiwon
f2b5a079db
refactor: remove SystemTag logic from Folder into QuerySearchHelper
- adds OC\SystemTag\SystemTagsInFilesDetector where the search logic is
  moved to

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-05-16 12:47:09 +02:00
Arthur Schiwon
c0dbde5fba
feat: specify media type via url path: systemtags-current/$mediaType
- only the media part of the mime type can be search, but not the full
  mime type. It can be added, should it become necessary.
- thus fixes previously hardcoded selector for image/ types
- also fixes a return type hint
- adds a return type hint

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-05-16 12:46:50 +02:00
Arthur Schiwon
2ea872d156
PoC: SystemTags endpoint to return tags used by a user with meta data
Target case is photos app: when visiting the tags category, all systemtags
of the whole cloud are retrieved. In subequent steps the next tag is
requested until the browser view is filled with tag tiles (i.e. previews
are requested just as well).

With this approach, we incorpoate the dav search and look for user related
tags that are used by them, and already returns the statistics (number of
files tagged with the respective tag) as well as a file id for the purpose
to load the preview. This defaults to the file with the highest id.

Call:
curl -s -u 'user:password' \
  'https://my.nc.srv/remote.php/dav/systemtags-current' \
  -X PROPFIND -H 'Accept: text/plain' \
  -H 'Accept-Language: en-US,en;q=0.5'  -H 'Depth: 1' \
  -H 'Content-Type: text/plain;charset=UTF-8' \
  --data @/home/doe/request-systemtag-props.xml

With request-systemtag-props.xml:
<?xml version="1.0" encoding="UTF-8"?>
<d:propfind xmlns:d="DAV:">
        <d:prop xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
                <oc:id/>
                <oc:display-name/>
                <oc:user-visible/>
                <oc:user-assignable/>
                <oc:can-assign/>
                <nc:files-assigned/>
                <nc:reference-fileid/>
        </d:prop>
</d:propfind>

Example output:
  …
  <d:response>
    <d:href>/master/remote.php/dav/systemtags/84</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>84</oc:id>
        <oc:display-name>Computer</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-assignable>true</oc:user-assignable>
        <oc:can-assign>true</oc:can-assign>
        <nc:files-assigned>42</nc:files-assigned>
        <nc:reference-fileid>924022</nc:reference-fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/remote.php/dav/systemtags/97</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>97</oc:id>
        <oc:display-name>Bear</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-assignable>true</oc:user-assignable>
        <oc:can-assign>true</oc:can-assign>
        <nc:files-assigned>1</nc:files-assigned>
        <nc:reference-fileid>923422</nc:reference-fileid>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  …

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-05-16 12:46:37 +02:00
Côme Chilliet
988c03a0a5
Fix return types in phpdoc
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-15 17:28:31 +02:00
Côme Chilliet
d618b8061c
Get rid of more int casts in file size manipulations
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-15 17:26:18 +02:00
Julius Härtl
27bd9e2ade fix: Check for wrapped retriable exceptions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-05-13 22:23:04 +00:00
Robin Appelman
a7b4d7bdc2 ignore errors while trying to update parent storage_mtime
in the worst case this should only cause an extra rescan later

Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-21 17:41:47 +00:00
Robin Appelman
40748731f1 clear encrypted flag when moving away from encrypted storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-01 16:49:37 +00:00
Joas Schilling
4bdc5834fa
Make sure name and path are strings
Otherwise Oracle returns NULL for empty strings and PHP 8.2
throws on null in string functions like trim() and md5()

Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-02-02 12:05:22 +01:00
Joas Schilling
c27c9fac98
Try fixing Oracle
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-02-02 12:05:21 +01:00
Côme Chilliet
f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +01:00
Git'Fellow
e855298b3c Switch logical operators
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-01-11 16:27:33 +00:00
Vincent Petry
3b7cc31f64
Merge pull request #34924 from nextcloud/cache-jail-path-prefix
escape path prefix when doing cache jail search
2022-12-16 17:27:15 +01:00
Andy Xheli
e69c7c4d26
Fix Executing a query: SQLSTATE[42000]
Signed-off-by: Andy Xheli <axheli@axtsolutions.com>

Fix https://github.com/nextcloud/server/issues/32007#issuecomment-1329405245

Signed-off-by: Andy Xheli <axheli@axtsolutions.com>
2022-11-29 11:24:56 -06:00
Robin Appelman
f76b4473ee
escape path prefix when doing cache jail search
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-02 12:44:51 +01:00
Vincent Petry
4aa8e80511
Merge pull request #34579 from nextcloud/unencrypted-size-null
fix null error in getUnencryptedSize
2022-10-21 16:53:43 +02:00
Carl Schwan
54031e370a Fix various other small psalm issues
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-17 12:40:35 +02:00
Robin Appelman
63316fc572
fix null error in getUnencryptedSize
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-10-13 15:34:48 +02:00
raul
95bc770a37 Fix unencrypted size calculation for files created before the Encryption storage is enabled
Signed-off-by: raul <raul@nextcloud.com>
2022-10-03 13:44:14 +02:00
raul
45a1ebcc4c Fix: Prevent deadlocks during mtime/size/etag propagation
Signed-off-by: raul <raul@nextcloud.com>
2022-10-03 13:44:14 +02:00
Robin Appelman
b6f8b8da60 directly build the search filter for shared storage instead of setting up the source cache
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-17 11:58:57 +02:00
Vincent Petry
312b719acf
Merge pull request #32943 from nextcloud/unencrypted-size-revert-interface-changes
Revert interface changes from "store unencrypted size in the unencrypted_size column"
2022-08-17 11:36:16 +02:00
Vincent Petry
11d5a1d3df
Merge pull request #33550 from nextcloud/jail-search-post
optimize search post-processing for jail wrapper
2022-08-17 10:55:41 +02:00