0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-13 07:53:51 +00:00
Commit graph

98 commits

Author SHA1 Message Date
Git'Fellow
8ec775bc84 fix(storage): Try to delete existing target
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2024-11-21 07:41:54 +01:00
Daniel Calviño Sánchez
6f962c75d4 fix: Fix copying or moving from shared groupfolders
When copying or moving between two local storages the source path (on
disk) to copy or move from is got from the unjailed path of the source
storage. However, if the source storage has more than one jail getting
the unjailed path resolves the most external jail, but the source path
needs to be got from the most internal jail instead (the one closer to
the local storage).

This can happen, for example, with a shared groupfolder: in that case
there is an external jail for the shared storage, and one internal jail
for the groupfolder storage wrapped by the shared storage.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2024-10-29 10:41:24 +00:00
John Molakvoæ
790ef0ea17 chore: improve hash_file php usage in Local Storage
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
2024-09-16 15:18:02 +00:00
Louis Chemineau
41111e5f0a fix(files): Ensure that the hash method does not return null
To match beececf660/lib/private/Files/View.php (L1050)

- Fix https://github.com/nextcloud/server/issues/44110

Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-09-16 15:18:02 +00:00
provokateurin
789be3c141 fix(Storage\Local): Do not call getSourcePath() on SplFileInfo
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-15 14:52:42 +00:00
Joas Schilling
0a429e0f80
fix(CI): Suppress psalm UndefinedClass
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-04-18 09:25:17 +02:00
Joas Schilling
546b0471ed fix(files): Also skip cross storage move with access control
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-04-17 14:31:50 +00:00
Côme Chilliet
0b332ceac2 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-04 11:45:22 +02:00
Benjamin Gaussorgues
5158bbf09b
fix: avoid scanning a non existing directory
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2024-03-14 16:26:52 +01:00
Robin Appelman
8418fcfedf
add some support for rename on case insensitive local filesystems
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-10-20 15:03:11 +02:00
Robin Appelman
ef87ff1848
Merge pull request from shdehnavi/replace_substr_calls_in_lib_private
Refactor "substr" calls in lib/private to improve code readability
2023-09-21 16:34:27 +02:00
Vincent Petry
8d1a3daa3f Allow ext storage Local to go unavailable
Whenever an external storage of type Local points at a non-existing
directory, process this as a StorageNotAvailable instead of returning
404.

This makes desktop clients ignore the folder instead of deleting it when
it becomes unavailable.

The code change was limited to external storages to avoid issues during
setup and with the default home storage.
Signed-off-by: Vincent Petry <pvince81@yahoo.fr>
2023-08-29 11:04:31 +02:00
Daniel Kesselberg
f1d4f7c7e4
fix: copy-and-delete fallback should use unlink
because rmdir does not work for files.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2023-07-31 21:41:25 +02:00
Daniel Kesselberg
b4ff557b8c fix(storage): fallback to copy and unlink when rename fails
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2023-07-31 18:54:21 +02:00
Hamid Dehnavi
d0b20534b9 Refactor "substr" calls to improve code readability
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
2023-07-07 04:54:20 +03:30
Lorenzo Tanganelli
6b55e92e33
invert elseif on rmdir for local storage
Signed-off-by: Lorenzo Tanganelli <lorenzo.tanganelli@hotmail.it>
2023-05-24 08:22:50 +02:00
Côme Chilliet
a90581b405
Get rid of more int casts in file size manipulations
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 12:46:16 +02:00
Robin Appelman
4cc5885615
Merge pull request from nextcloud/free-space
Check free space only if source exists and is dir
2023-04-21 13:55:42 +02:00
Côme Chilliet
426c0341ff
Use typed version of IConfig::getSystemValue as much as possible
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-05 12:50:08 +02:00
Côme Chilliet
4393b96542
Remove unused method getLocalFolder
It’s not used and not in any OCP interface/class.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-03 10:52:34 +02:00
Côme Chilliet
8104d9f5d8
Remove useless coalescing operator on non-null return value
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-01 14:20:26 +02:00
Côme Chilliet
3f84d41226
Silence a warning from psalm with explanation
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-01 14:20:25 +02:00
Git'Fellow
28231ae515
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-03-07 17:09:24 +01:00
Git'Fellow
9ac065fb92
Fix free space problems
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-03-07 00:13:57 +01:00
Côme Chilliet
308fcf4526
Respect OCP interface in private classes
Because the parameter type was moved to phpdoc it needs to be removed
 from implementations

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-07 11:23:35 +01:00
Côme Chilliet
ff776a90b1
Strong type filesize related methods to ease 32bits problem findings
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-07 11:23:28 +01:00
Côme Chilliet
e156f8339c
Revert "remove 32-bit workarounds"
This reverts commit dd8774389e.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-02-07 11:23:28 +01:00
Robin Appelman
33b90d28f8 fix moving files of encrypted local storage to unencrypted local storage
for example when moving encrypted files to a groupfolder

Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-01-24 16:40:41 +00:00
szaimen
3f7c620f26 fix psalm
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-11-02 11:13:34 +01:00
szaimen
dd8774389e remove 32-bit workarounds
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-11-02 11:13:34 +01:00
Carl Schwan
a5ea677370 Rename file1 and file2 to source and target in Storage abstraction
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-10-18 17:21:47 +02:00
Robin Appelman
cb51564356 trigger a rescan when trying to fopen a file that exists in cache but not on disk
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-09-29 11:17:16 +02:00
Tigran Mkrtchyan
f41209a061 config: add a switch to control truncate before update
To avoid extra truncate on non WORM file systems, add a new config
option `localstorage.unlink_on_truncate`, which defaults to false.

The OC\Files\Storage\Local is update to respect that option.

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
2022-09-16 11:10:32 +02:00
Tigran Mkrtchyan
8fc4cf67f1 files: remove destination file before copying new content (WORM)
Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
2022-09-16 10:57:17 +02:00
Tigran Mkrtchyan
b6065a236f files: make OC\Files\Storage\Local WORM friendly
Some filesystems run as a Write-Once-Read-Many storages. This
makes them impossible to use with NexeCloud, as the file system
layers uses `truncate` syscall (through file_put_contents function).

As Nextcloud is never updates existing files, removing the old entry
and creatint a new one on update will allow NextCoud to update on such
file systems.

Update Local#fopen and Local#file_put_contents to remote existing
file before truncating.

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
2022-08-25 11:11:49 +02:00
Martin Brugnara
7409569994
Expose umask override value as config parameter: localstorage.umask
Commit 451c06d introduced override for umask value.
This is needed to avoid broken env configuration or dirty workers
to mess with the permissions when creating new files.

Most Nextcloud, that does not integrate with external software
would work fine with an hard-coded value (451c06d set it at 022).

Advanced install may require more flexibility, as such this commit
exposes the "umask override value" as configuration parameter:
`localstorage.umask`

It defaults to 0022 both in code and in config/config.sample.php .

Signed-off-by: Martin Brugnara <martin@0x6d62.eu>
2022-06-05 19:19:31 +02:00
Côme Chilliet
23f7a37c03
Remove ILogger usages in lib/private/Files/Storage
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-26 16:52:53 +02:00
Robin Appelman
468d6a9cf1
ignore forbidden files while scanning local storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-20 13:01:16 +02:00
Robin Appelman
84f464550a
some file scanner performance improvements
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-17 22:21:16 +01:00
acsfer
152e2bfdaa
Check for disk_free_space
Check for `disk_free_space` before calling it.
Fix https://github.com/nextcloud/server/issues/29748
2021-11-18 11:46:13 +01:00
Carl Schwan
9408f8ae69
Fix security issues when copying groupfolder with advanced ACL
Using advanced ACL, it is possible that an user has access to a
directory but not to a subdirectory, so the copying use
Common::copyFromStorage instead of Local::copyFromStorage.

Fix https://github.com/nextcloud/groupfolders/issues/1692

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2021-10-21 17:11:52 +02:00
John Molakvoæ
a1c8b6e9eb
Merge pull request from nextcloud/check-file-exists 2021-10-18 09:54:22 +02:00
acsfer
98eac0fc05
Simplify :) 2021-10-04 17:21:37 +02:00
acsfer
8a8df49bc0
Replace file_exists() method by is_file() 2021-10-04 17:20:17 +02:00
acsfer
3a25183b66 Get filesize() if file_exists()
Should make sense.
2021-10-01 21:02:38 +00:00
Daniel Kesselberg
e60a829b42
explicitly close source stream on local storage
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-09-21 17:41:59 +02:00
Rid
0469acfb20 Fix scanner mistaking socket files for directories
Signed-off-by: Rid <rid@cylo.io>
2021-06-17 11:44:44 +01:00
John Molakvoæ (skjnldsv)
215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02:00
Roeland Jago Douma
f3738eeff7
Merge pull request from nextcloud/explicit-file-permissions
Set umask before operations that create local files
2021-03-30 21:55:50 +02:00
Robin Appelman
aee4caed07
show better error messages when a file with a forbidden path is encountered
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-24 17:13:09 +01:00