Commit graph

192 commits

Author SHA1 Message Date
Lukas Reschke
8f09d5b67c Update license headers 2015-10-26 14:04:01 +01:00
Lukas Reschke
13e817e901 Throw exception on getPath if file does not exist
Currently the `getPath` methods returned `NULL` in case when a file with the specified ID does not exist. This however mandates that developers are checking for the `NULL` case and if they do not the door for bugs with all kind of impact is widely opened.

This is especially harmful if used in context with Views where the final result is limited based on the result of `getPath`, if `getPath` returns `NULL` PHP type juggles this to an empty string resulting in all possible kind of bugs.

While one could argue that this is a misusage of the API the fact is that it is very often misused and an exception will trigger an immediate stop of execution as well as log this behaviour and show a pretty error page.

I also adjusted some usages where I believe that we need to catch these errors, in most cases this is though simply an error that should hard-fail.
2015-10-25 17:58:21 +01:00
Robin Appelman
9d7138aa50 Dont lock /$user/files 2015-10-23 14:59:16 +02:00
Roeland Jago Douma
3a14cfc295 Removemount expects absolutePath 2015-10-16 14:14:00 +02:00
Morris Jobke
b945d71384 update licence headers via script 2015-10-05 21:15:52 +02:00
Vincent Petry
64ca00925b Prevent moving mount point into already shared folder (outgoing)
It is already not allowed to share a folder containing mount points /
incoming shares.

This fixes an issue that made it possible to bypass the check by moving
the incoming share mount point into an existing outgoing share folder.
2015-10-02 16:14:42 +02:00
Thomas Müller
df75c17e52 Merge pull request #16479 from owncloud/core-fixgetrelativepathwrongmatches
Prevent wrong matches in getRelativePath
2015-09-24 10:25:00 +02:00
Thomas Müller
bcdb3c26da Merge pull request #19236 from owncloud/call_dot_directories_function
Replaces if ($file === '.' || $file === '..') by public function call isIgnoredDir
2015-09-23 11:34:23 +02:00
Martin
491250320a Replaces if ($file === '.' || $file === '..') by if(\OC\Files\Filesystem::isIgnoredDir($file)). Eases to find where this operation is used. 2015-09-22 17:53:15 +02:00
Vincent Petry
b9cd5bc1dc Prevent wrong matches in getRelativePath
Before this fix, the root "/files" with path "/files_trashbin" would
return "_trashbin" as relative path...
2015-09-22 11:34:37 +02:00
Bjoern Schiessle
17a64360e5 catch excexptions during the copy operation and make sure that we free the lock correctly 2015-09-22 11:32:10 +02:00
Thomas Müller
d5bba42030 Merge pull request #17932 from owncloud/fix_move_files
make sure that hooks are emitted properly on file move operation
2015-08-11 13:54:09 +02:00
Vincent Petry
143e4a81f0 Fix removal of share permissions when share disabled for user 2015-08-07 15:43:27 +02:00
Lukas Reschke
ad4c731c4c Correct regular expressions
Previously the regex was only matching on single characters. Meaning that file names such as "👍.txt" where possible while "👍" alone never was. This check apparently never worked as expected.
2015-07-30 11:22:14 +02:00
Bjoern Schiessle
fb4c99fe06 make sure that we emit the hooks if a file gets moved from a subfolder to the root folder with the nodes API 2015-07-29 11:02:38 +02:00
Thomas Müller
d3ac73c0c9 Remove OC_Log 2015-07-03 18:00:16 +02:00
Vincent Petry
16ff6cff54 Merge pull request #17256 from owncloud/locking-disablecallbackwrapperwhendisabled
Do not set callback wrapper when locking is disabled
2015-06-30 18:28:28 +02:00
Vincent Petry
afd83caf69 Do not set callback wrapper when locking is disabled 2015-06-30 13:45:41 +02:00
Vincent Petry
167f57c15e Unlock first path on rename if second path is locked 2015-06-29 17:31:14 +02:00
Vincent Petry
538e466c30 Keep shared locks in post hooks
Instead of unlocking after the file operation, change exclusive locks
back to shared locks during post hooks, and unlock after that.

Also added unit tests to test locking in pre-hooks, during operation and
post-hooks.
2015-06-25 16:33:02 +02:00
Vincent Petry
35047a2300 Fix locked paths in the moveMount case
When moving a mount point directly, the lock must be applied on the
local mount point path instead of the attached storage root.

Other operations will still lock the attached storage root.
2015-06-24 11:33:28 +02:00
Thomas Müller
ced15c44b4 Merge pull request #16657 from owncloud/view-emit-path
emit hooks from a view as long as the path is inside the default root
2015-06-22 11:29:11 +02:00
Vincent Petry
6697f9524c Merge pull request #16963 from owncloud/fileinfo-lock
Acquire read lock when getting file or directory info
2015-06-18 18:27:20 +02:00
Robin Appelman
17be0993b4 remove unneeded normalize 2015-06-18 15:33:44 +02:00
Robin Appelman
6018567df2 unlock the file if the file doesnt exists 2015-06-18 15:26:17 +02:00
Robin Appelman
d7960d5db6 dont update the cache on rename fail 2015-06-18 14:45:13 +02:00
Robin Appelman
3526b352dc update the file cache within the write lock 2015-06-18 13:47:03 +02:00
Robin Appelman
72eedda16c use old cache data when locked 2015-06-17 14:13:10 +02:00
Thomas Müller
d2305f2527 Merge pull request #16729 from owncloud/scanner-read-lock
keep a read lock while scanning a file or folder
2015-06-17 11:52:54 +02:00
Vincent Petry
102c6ffc41 Normalize path in View's lock methods 2015-06-16 17:03:12 +02:00
Vincent Petry
e5d34a2733 Merge pull request #16892 from owncloud/lock-returnfullpath
Rethrow LockedException with full path
2015-06-16 16:47:10 +02:00
Vincent Petry
0e3a3dd5d7 Rethrow LockedException with full path
Because the path is converted to md5 from the original exception,
rethrow the exception with the correct full path
2015-06-16 10:48:31 +02:00
Robin Appelman
567df226e5 fix check if hooks should be emited in runHooks 2015-06-15 15:07:48 +02:00
Robin Appelman
9c0d69a3b2 ensure normalized path form when changing locks 2015-06-15 14:32:29 +02:00
Robin Appelman
a4f808b11d properly unlock in case of failed fopen 2015-06-15 14:32:29 +02:00
Robin Appelman
7d72f7d8ce keep a read lock while scanning a file or folder 2015-06-15 14:32:29 +02:00
Thomas Müller
911c43e5f9 Merge pull request #16727 from owncloud/file-put-content-lock
add proper locking to file_put_contents when using streams
2015-06-15 14:22:06 +02:00
Vincent Petry
4497aa4c68 Webdav PUT small file lock must be shared during hooks
Fixed code path for Webdav PUT of small files to use shared locks during
hook execution, and exclusive during the file operation

This makes it possible for versions to be copied by accessing the file
in a post_write hook.
2015-06-12 18:52:18 +02:00
Joas Schilling
5586b2db09 Don't use limit on explode to have only 1 code path 2015-06-12 11:58:26 +02:00
Joas Schilling
a7d2b3b9ae Add return value to lock methods and check it in tests 2015-06-12 11:41:05 +02:00
Joas Schilling
caf16b083e Only lock files in data/username/files/ 2015-06-12 11:09:38 +02:00
Robin Appelman
bcf13aff6f change lock back to shared before updating the cache 2015-06-03 17:18:50 +02:00
Robin Appelman
6b0874203d add proper locking to file_put_contents when using streams 2015-06-03 17:18:50 +02:00
Robin Appelman
4b48dd424f emit hooks from a view as long as the path is inside the default root 2015-06-02 14:07:20 +02:00
Robin Appelman
ce04cf6610 shared lock around hooks 2015-06-01 13:24:02 +02:00
Robin Appelman
437c0b55a6 unlock source file when we cant lock the target in a rename 2015-06-01 13:22:56 +02:00
Robin Appelman
f0b8672729 fix locking root of a view 2015-06-01 13:22:56 +02:00
Robin Appelman
2d63fd77de dont apply callback wrapper when fopen failed 2015-06-01 13:22:56 +02:00
Robin Appelman
1270c6800d dont lock on meta data operations 2015-06-01 13:22:56 +02:00
Robin Appelman
35c377f7a9 phpdoc and minor issues 2015-06-01 13:22:56 +02:00