When computing the unencrypted file size, we need the size of the last encrypted chunk as its size is usually not the regular 8192 bits.
To avoid reading the whole file, we seek directly to that last chunk based on the expected file size. When the expected file size is smaller than the actual one, we have a logic in place to continue reading until we reach the end of the file.
In that logic, we forgot to increment the `$lastChunkNr` which is important when we later check the signature of the chunk.
This commit adds that missing increment.
Signed-off-by: Louis Chmn <louis@chmn.me>
Add retriesMaxAttempts parameter to S3 objectstore configuration
to allow customization of AWS SDK retry behavior for handling
unreliable network conditions or proxy issues.
Defaults to 5 retries (AWS SDK default) if not specified.
Signed-off-by: nfebe <fenn25.fn@gmail.com>
Otherwise, we call doesBucketExist all the time which does a network
request to the S3 server adding some non-trivial latency when creating a
S3 connection object.
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
Fix https://github.com/nextcloud/server/issues/56077
This commit makes the configuration settings 'request_checksum_calculation' and 'response_checksum_validation' of the S3Client from the AWS SDK for PHP configurable.
Signed-off-by: Fiehe Christoph <c.fiehe@eurodata.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Fix "Typed property OC\\Files\\Cache\\Cache::$storage must not be accessed before initialization"
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
The quota is now decremented by the actual number of bytes written ($written) rather than the intended size.
This ensures quota tracking stays accurate even if fwrite writes fewer (or more - i.e. from underlying buffering/etc) bytes than requested.
Signed-off-by: Josh <josh.t.richards@gmail.com>
to avoid 'object::%' to be considered as a column
(`la colonne \\u00ab object::% \\u00bb n'existe pas` on PG)
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
- Add missing type hinting
- Use only public methods from IStorage instead of relying on internal
\OC\Storage methods
- Refactor HomePropagator to use ignore argument from Propagator instead
of reimplementing the same logic.
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
And move it to a different table so that we don't have to pay the
storage cost when not using it (most of the times).
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
It's in OC and should not be used at all. Marking it as internal will
at least prevent new code to use it.
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
This work similarly to the move preview job to migrate the previews to
the new DB table and also reuse some code.
So when we are finding files in appdata/preview, try adding them to the
oc_previews table and delete them from the oc_filecache table.
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
* Simplify migration by not moving the actual files and just updating
the DB
* Don't store the storageid in the preview table as it is not needed
* Start adding tests
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
The new oc_previews table is optimized for storing previews and should
decrease significantly the space taken by previews in the filecache
table.
This attend to reuse the IObjectStore abstraction over S3/Swift/Azure
but currently only support one single bucket configuration.
Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>