Commit graph

1240 commits

Author SHA1 Message Date
Julius Härtl
edefc25c8a fix: Throw instead of yielding nothing when listing local directories
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2024-02-26 14:01:37 +00:00
Julius Härtl
8ddcebe3bd
fix: Only read unencrypted_size when file is actually encrypted
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-09-12 15:07:15 +02:00
Julius Härtl
19cf570aac
fix: Only store unencrypted_size if path should be encrypted
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-09-12 15:07:15 +02:00
Arthur Schiwon
cb607b5b8d
Merge pull request #40233 from nextcloud/fix/fix-video-seeking-public-link
[stable25] Detect aborted connection in OC\Files\View and stop writing data to the output buffer
2023-09-05 18:54:31 +02:00
Arthur Schiwon
4299e1517d
Merge pull request #40188 from nextcloud/backport/39017/stable25
[stable25] fix(s3): fix handling verify_bucket_exists parameter
2023-09-05 17:46:40 +02:00
Arthur Schiwon
e004f8099a
Merge pull request #39731 from nextcloud/backport/39698/stable25
[stable25] Catch more invalid cache source storage paths
2023-09-05 17:45:25 +02:00
Côme Chilliet
6b2580d49a
Apply suggestions from code review in View.php
Co-authored-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Signed-off-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-09-05 14:36:23 +02:00
Côme Chilliet
168b07d038
Lower log to debug for connections aborted by the client
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-09-04 16:45:14 +02:00
Côme Chilliet
cb2a6d688f
Detect aborted connection in OC\Files\View and stop writing data to the
output buffer

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-09-04 14:58:30 +02:00
Thomas Citharel
fe37e5590b fix(s3): fix handling verify_bucket_exists parameter
If 'verify_bucket_exists' is set to false in the config.php s3 configuration, it's supposed to avoid
verifying that the bucket exists. However empty(falsy) will  always return true, so this condition
would not work.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2023-08-31 21:45:44 +00:00
Robin Appelman
2f1c599810
Merge pull request #39703 from nextcloud/cache-imcomplete-id-first-25
[stable25] Select the fileid first when looking for incomplete files
2023-08-28 14:18:48 +02:00
Robin Appelman
c8cf2ebf17
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-28 13:30:01 +02:00
Anna Larch
1e957b5c87
fix: don't emit Hooks when hookpaths are empty
Signed-off-by: Anna Larch <anna@nextcloud.com>
Signed-off-by: Max <max@nextcloud.com>
2023-08-28 11:45:01 +02:00
John Molakvoæ
3330403031 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-06 08:46:08 +00:00
Josh Richards
cc801d7c2f 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-06 08:46:07 +00:00
Arthur Schiwon
e6438c3967 fix(node): non-existing folder is not searchable
the previosuly introduced searchBySystemTag was not overwritten in
NonExistingFolder and could run the inherited method.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-13 15:05:25 +00:00
Arthur Schiwon
2ca8c7102b
fix: PHP 7.4 compatibility
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-10 12:42:30 +02:00
Arthur Schiwon
33b9ba5cd9
refactor: adjust to unexposed searchBySystemTag
- in this backport we have to drop the breaking addition in
  \OCP\Files\Folder
- this requires adjustments in check for the existance of the method but
  also in testing
- another change in \OCP\SystemTag\ISystemTagManager can be applied as
  this interface is not implemented elsewhere

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 17:56:54 +02:00
Arthur Schiwon
1ffae9d110
fix: cominbation of small fixes
- possible null return
- parameter name mismatch in implementation
- incomplete unit test

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 17:55:50 +02:00
Arthur Schiwon
d21b251a85
fix: include invisible tags for admins
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 17:55:45 +02:00
Arthur Schiwon
837fd9f8da
fix: favorites view and universal search against tags
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 17:43:46 +02:00
Arthur Schiwon
5086dff563
fix: change if with conditionless else to switch; and a parameter value
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-07 17:43:40 +02:00
Arthur Schiwon
7e2ad76505
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 17:43:34 +02:00
Arthur Schiwon
eba105b9a8
Merge pull request #39153 from nextcloud/backport/39115/stable25
[stable25] fix(sse): don't update uncached files
2023-07-06 18:43:25 +02:00
Arthur Schiwon
1eb9f1874d
fix: adjust to PHP level and codebase
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-04 23:36:06 +02:00
Arthur Schiwon
2930f890d6
ci: adjust return annotation to older psalm version
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-04 23:14:56 +02:00
Arthur Schiwon
c2fdee7f6e
ci: pro forma check of existence of internal method
createNode() is protected and used by Folder, but being an internal-only
method it shall not be exposed in the Folder or IRootFolder interface.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-04 23:12:58 +02:00
Arthur Schiwon
481cbafae3
refactor: declare getMount() and getMountsIn() at IRootFolder
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-04 23:10:33 +02:00
Arthur Schiwon
d5b69c1698
chore: ugly type juggling
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-04 23:10:25 +02:00
Arthur Schiwon
e5e9df2948
fix: add typehine for IRootFolder
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2023-07-04 23:10:03 +02:00
Arthur Schiwon
5640339d1d
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-07-04 23:06:28 +02:00
Richard Steinmetz
848b8eb477 fix(sse): don't update uncached files
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
2023-07-04 20:30:09 +00:00
Robin Appelman
3fe5279355
use source cache when listing folder during recursive copy
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-06-19 12:30:10 +02:00
Arthur Schiwon
2d75209794
Merge pull request #38022 from nextcloud/backport/32877/stable25
[stable25] allow storing multiple mounts for the same rootid in the mount cache
2023-06-15 11:47:44 +02:00
Robin Appelman
d2d8704645
set stream size for SeekableHttpStream
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-06-12 16:29:12 +02:00
Robin Appelman
0b40b11289
allow storing multiple mounts for the same rootid in the mount cache
currently `[$userId, $rootId]` is used as the unique key for storing mounts in the mount cache,
however there are cases where the same rootid is mounted in multiple places for a user which currently leads to not all of those mounts being added to the cache.

Previously this didn't matter as the mount cache was only used to list users with access to a specific file, so a user having access to the file multiple times didn' change anything.

With 24 the mount cache is used for more cases and multiple mounts for the same id becomes relevant.
While I think there isn't a real negative effect atm besides missing the optimized path we should ensure that the mounts are properly listed

Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-05-31 16:15:47 +02:00
Julius Härtl
b339ef5131 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
cf2b8e9866
Merge pull request #38309 from nextcloud/backport/37961/stable25
[stable25] SystemTags endpoint to return tags used by a user with meta data
2023-05-17 18:58:59 +02:00
Arthur Schiwon
b4f562bc2f
Merge pull request #37702 from nextcloud/backport/37617/stable25
[stable25] handle not being able to write file for notify self-test
2023-05-17 13:10:22 +02:00
Arthur Schiwon
0612ad250e
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:59:10 +02:00
Arthur Schiwon
1e5de8aff4
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:59:04 +02:00
Arthur Schiwon
de008e1109
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:58:47 +02:00
Arthur Schiwon
8ec4760645
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:58:42 +02:00
Côme Chilliet
dee180409b
Merge pull request #38203 from nextcloud/backport/36893/stable25
[stable25] Make sure to never trigger files hooks on a null path
2023-05-15 11:26:33 +02:00
Julius Härtl
2788dfc4f2 fix: Check for wrapped retriable exceptions
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-05-13 22:23:05 +00:00
Côme Chilliet
8faf854a03 Make sure to never trigger files hooks on a null path
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 14:43:04 +00:00
Julius Härtl
46e924aa7b
fix: Use proper path when creating node instances
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-05-09 13:00:04 +02:00
Robin Appelman
d0538bca49
Merge pull request #37876 from nextcloud/backport/37820/stable25
[stable25] ignore errors while trying to update parent storage_mtime
2023-04-24 17:11:30 +02:00
Robin Appelman
5c8a8df114 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
Git'Fellow
99a8cabbcd Add function_exists() check
Co-authored-by: Simon L. <szaimen@e.mail.de>
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-04-21 17:04:38 +00:00