Commit Graph

1036 Commits

Author SHA1 Message Date
Robin Appelman 728488fcf5 add (hidden) option to always show smb root as writable
some smb servers are very insistent in reporting that the root of the share is readonly, even if it isn't.

This works around the problem by adding a hidden option to overwrite the permissions of the root of the share.

This can be enabled using

```bash
occ files_external:config <mount id> root_force_writable true
```

where you can find your mount id using

```bash
occ files_external:list
```

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-19 15:47:23 +00:00
Morris Jobke 4f18ff9815
Merge pull request #25944 from nextcloud/backport/25659/stable20
[stable20] catch notfound and forbidden exception in smb::getmetadata
2021-03-17 20:13:57 +01:00
Morris Jobke 9749514649 Use correct exception type hint in catch statement
Found by psalm update 4.6.2 to 4.6.3 in #26111

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-03-17 08:47:07 +00:00
Robin Appelman 326f7ac857 catch notfound and forbidden exception in smb::getmetadata
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-05 07:54:09 +00:00
Roeland Jago Douma b986c9e4e5
Merge pull request #25132 from nextcloud/backport/24661/stable20
[stable20] dont offer to edit external config settings if we can't edit them
2021-02-18 19:41:49 +01:00
Julius Härtl fcfa39183c Properly handle SMB ACL blocking scanning a directory
This makes sure that a possible ForbiddenException is properly passed
through the storage as a ForbiddenException and can be catched when
trying to fetch the quota info of a parent folder

Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-02-01 11:13:44 +00:00
Joas Schilling fcdbd4eca3
Fix potential empty result
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-01-20 10:11:56 +01:00
Joas Schilling 85781d8d36
Compare and store the login name via the event
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-01-20 09:09:15 +01:00
Joas Schilling 0c7f0a7d89
Also fix the username when it changed
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-01-20 09:08:08 +01:00
Joas Schilling 8e3e1f9a32
Don't save credentials of another user
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-01-20 09:08:00 +01:00
Robin Appelman e0d85ed9a8 dont offer to edit external config settings if we can't edit them
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-01-14 16:33:13 +00:00
Vincent Petry 958f7968e3
Adjust further columns
- calendarsubscriptions.lastmodified -> not null
- external_config.value -> allow null

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2020-12-14 11:12:50 +01:00
Robin Appelman 987cd0d5ed set mountid for personal external storage mounts
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-12-02 18:50:58 +00:00
Joas Schilling 19816fe85f Don't leave cursors open when tests fail
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-10 14:18:02 +00:00
Roeland Jago Douma 42d56c9655 Check if array elements exist before using them
It seems that in some recent upgrade here. Not always the entries we
expect are returned. So we should first check if they exist. As to not
spam the log.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-10-27 10:57:51 +00:00
Morris Jobke bd11c9c620
Merge pull request #23426 from nextcloud/backport/23021/stable20
[stable20] allow using saved login credentials for notify
2020-10-19 10:12:38 +02:00
Robin Appelman 43778d8aae
add option to disable notify self check
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-10-14 14:06:40 +02:00
Robin Appelman d5e77685a4 also give storage backend it's change to manipulate the config
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-10-13 17:44:21 +00:00
Robin Appelman b750503f4a allow using saved login credentials for notify
when only the user is provided, we use to provided user to try and get saved login credentials

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-10-13 17:44:20 +00:00
Robin Appelman eba4723428 improve handling of out of space errors for smb
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-09-17 18:47:33 +00:00
Morris Jobke 99c9423766
Remove @suppress SqlInjectionChecker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +02:00
Julius Härtl 2004ae4603
Set delimiter so that the CommonPrefixes response can properly be determined
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-09-10 08:11:55 +02:00
Robin Appelman fc96fa0cc7
fix s3 doesDirectoryExist check for empty directories
if a directory is empty, only the 'marker' object `/` exists.

since not all s3 implementations return just the prefix when listing objects by prefix,
when listing objects by the folder prefix, nothing will be returned if the directory is empty.
by not including the trailing slash in the prefix, the folder marked will always be returned if it exists

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-09-10 08:11:55 +02:00
Roeland Jago Douma bb06b6cce4
Fix reading empty files from objectstorage
Since we try to do range requests this will fail hard.
However since empty files are not that interesting to read anyways we
just read from an emptry memory stream.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-09-09 20:45:13 +02:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +02:00
Morris Jobke ac73982395
Merge pull request #21734 from nextcloud/external-s3-no-touch
disable touch to update mtime for external s3 storage
2020-08-20 16:07:59 +02:00
Morris Jobke fedf9c69d9
Use matching parameter names form interfaces and implementations
Found by Psalm 3.14.1

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-19 18:16:35 +02:00
Morris Jobke d7f66c36ac
Fix "misplaced variables" warning of Psalm in PHPDoc statements
Ref #21787

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-17 17:46:57 +02:00
Daniel Kesselberg 6f8147b18f
Fix some MissingDocblockType or InvalidDocblock warnings.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-08-14 15:10:48 +02:00
Morris Jobke afd52c6b12
Remove setCustomJs of the files_external FrontendDefinitionTrait
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-13 21:49:50 +02:00
Daniel Kesselberg ba3a855ad8
Remove unused method uploadFile
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-08-13 08:02:28 +02:00
Morris Jobke 0b0cc48c88
Move event listener to dedicated class
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-30 12:04:56 +02:00
Robin Appelman d1bd3ba594
update saved credentials on password change
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-30 11:43:15 +02:00
Robin Appelman c864e5dfc2
remove saved credentails if the user no longer has any storage configured using them
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-30 11:43:15 +02:00
Robin Appelman 7ad0f66fc4
Only save login credentials in database once there is an external storage that needs it
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-30 11:43:15 +02:00
Morris Jobke 638e9438a9
Merge pull request #21728 from nextcloud/bugfix/noid/s3-external-mtime-cache
Reuse cache for directory mtime/size if filesystem changes can be ignored
2020-07-15 18:26:48 +02:00
Morris Jobke cbbbbee8b1
Merge pull request #21785 from nextcloud/techdebt/noid/remove-classmap-in-files_external
Move OC_Mount_Config to proper classname and remove OC::$CLASSPATH us…
2020-07-13 16:47:12 +02:00
Robin Appelman e357d46863
filter files containing a hash in the path for ftp storages
the php ftp streamwrapper doesn't handle hashes correctly and will break when it tries to enter a path containing a hash.

By filtering out paths containing a hash we can at least stop the external storage from breaking completely

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-10 14:18:40 +02:00
Morris Jobke 065ef14cb0
Move OC_Mount_Config to proper classname and remove OC::$CLASSPATH usage in files_external
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-07-10 00:02:59 +02:00
Robin Appelman 0d6910ac13
disable touch to update mtime for external s3 storage
since updating the mtime requires doing a copy this can have a significant overhead and it messes with versioning

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-07-07 15:55:38 +02:00
Julius Härtl f5cc34c9c2
Reuse cache for directory mtime/size if filesystem changes can be ignored
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-07-07 10:22:22 +02:00
Joas Schilling 347ab5241c
Move files_external to migrations
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-07-06 16:42:14 +02:00
Joas Schilling d7c0b9cced
Also always return in app commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-26 15:12:11 +02:00
Julius Härtl 69f4c50032
Remove rescanDelay from directory mtime
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-06-22 14:15:57 +02:00
Robin Appelman 6f2e920a5b
normalize sftp path in read and write stream
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-05-25 15:26:04 +02:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02:00
Robin Appelman 7f32fe6d50
add tooltip to option
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-22 14:25:33 +02:00
Robin Appelman 23e2baeb95
Add option to check share ACL's when listing directories
If a file or folder in a directory doesn't have read permissions they
will not be shown

Note that enabling this option incurs a performance penalty additional
requests need to be made to get all the acl.

Additionally the acl resolving logic is fairly primitive at the moment
and might not work correctly in all setups (it should error to showing
the entry)

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-21 16:26:12 +02:00
Robin Appelman 9735b5d61f
Add method to storage backends to get directory content with metadata
Currently you need to use `opendir` and then call `getMetadata` for
every file, which adds overhead because most storage backends already
get the metadata when doing the `opendir`.

While storagebackends can (and do) use caching to relief this problem,
this adds cache invalidation dificulties and only a limited number of
items are generally cached (to prevent memory usage exploding when
scanning large storages)

With this new methods storage backends can use the child metadata they
got from listing the folder to return metadata without having to keep
seperate caches.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-20 15:45:04 +02:00
Julien Lutran 3e849daf11
Fix issues with Keystone auth v3 in files_external app
Signed-off-by: Julien Lutran <julien.lutran@corp.ovh.com>
2020-04-15 10:33:08 +02:00