hashes are set in "X-Hash-MD5", "X-Hash-SHA1" and "X-Hash-SHA256" headers.
these headers are set for file uploads and the MOVE request at the end of a multipart upload.
Signed-off-by: Robin Appelman <robin@icewind.nl>
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
during large file uploads, the shared lock that we get at the begining can expire
leading to locked errors later on, instead of erroring, try to re-get the lock
Signed-off-by: Robin Appelman <robin@icewind.nl>
Fixes#14298
If a storage doesn'tclose the write stream then $isEOF is not yet set.
So we have to fallback.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
The stream is already closed at this point. Which means feof will always
return false. We have to determine if the stream is EOF in the
preCloseCallback. And pass this info along. Then the logic works as
expected.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
When $data is null (which can happen when $request->getBodyAsStream() returns
null), the Exceptions says "copied bytes: 0, expected filesize: 0", which
sounds more like success...
this removes the need for temporary storages with some external storage backends.
The new method is added to a separate interface to maintain compatibility with
storage backends implementing the storage interface directly (without inheriting common)
Currently the interface is implemented for objectstorage based storages and local storage
and used by webdav uploads
Signed-off-by: Robin Appelman <robin@icewind.nl>
The old code would emit the hooks twice. Thus having the version written
twice. Which is not very performant as it is first read twice as well.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
We have a function for it so better to override that. Also because other
codes that might check this should get the right value.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
In PHP 7.X hexadecimal notation support was removed from "is_numeric",
so "sanitizeMtime" directly rejected those values; in PHP 5.X, on the
other hand, "sanitizeMtime" returned 0 when a string with hexadecimal
notation was given (as it was the behaviour of "intval"). To provide a
consistent behaviour between PHP versions, and given that it does not
make much sense to send X-OC-MTime in hexadecimal notation, now
X-OC-MTime is always rejected if given as a string with hexadecimal
notation.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Directly calling "header" in the PHPUnit process causes the "Cannot
modify header information - headers already sent by" error to be thrown.
Instead of running the test in a separate process, which is slower, this
commit wraps the call to "header" in a method that can be mocked in the
tests.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This will be used in a following commit to test how the X-OC-MTime
header is handled.
This commit is based on the "make File::put() more testable" commit
(included in 018d45cad97e0) from ownCloud by Artur Neumann.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit extends the changes introduced in pull request #3793 also to
chunked uploads.
The "sanitizeMTime" method name is the same used in the equivalent pull
request to this one from ownCloud (28066).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>