Fix sse size mismatch 15094702859884413816#216
Fix sse size mismatch 15094702859884413816#216TheSpaceGod wants to merge 30 commits intonextcloud:mainfrom
Conversation
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/` including `debug_sizes.php`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/` including extensive size debugging tools. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans, and correctly handle single file inputs. - Updated `LangRopeService` to use the `$size` property for the `Content-Length` header in the API request, overriding the auto-detection which uses `fstat` (returning encrypted size). Casts size to string to satisfy Guzzle requirements. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added reproduction scripts in `tests/reproduction/`. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans, and correctly handle single file inputs. - Updated `LangRopeService` to wrap the content stream in a Guzzle `FnStream` and override the `getSize()` method to return the logical size. This ensures Guzzle calculates the correct `Content-Length` for the multipart request body, preventing `cURL error 26` (EOF fail) caused by `fstat` returning the encrypted size. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added robust reproduction scripts in `tests/reproduction/` including encryption verification and size debugging. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans, and correctly handle single file inputs. - Updated `LangRopeService` to wrap the content stream in a Guzzle `FnStream` and override the `getSize()` method to return the logical size. This ensures Guzzle calculates the correct `Content-Length` for the multipart request body, preventing `cURL error 26` (EOF fail) caused by `fstat` returning the encrypted size. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added robust reproduction scripts in `tests/reproduction/` including encryption verification and size debugging. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
This commit fixes a bug where uploading files with Server-Side Encryption (SSE) enabled failed due to a size mismatch between the decrypted stream and the physical file size. Changes: - Modified `Source` class to accept an optional `$size` property. - Updated `IndexerJob` to pass the logical (decrypted) file size to the `Source`. - Updated `ScanService` to pass the logical file size to the `Source` during manual scans, and correctly handle single file inputs. - Updated `LangRopeService` to wrap the content stream in a Guzzle `FnStream` and override the `getSize()` method to return the logical size. This ensures Guzzle calculates the correct `Content-Length` for the multipart request body, preventing `cURL error 26` (EOF fail) caused by `fstat` returning the encrypted size. - Added `getAppApiFunctions` to `LangRopeService` to facilitate testing. - Added unit tests in `tests/unit/Service/LangRopeServiceTest.php` to verify the fix. - Added robust reproduction scripts in `tests/reproduction/` including encryption verification and size debugging. Co-authored-by: TheSpaceGod <17182063+TheSpaceGod@users.noreply.github.com>
kyteinsky
left a comment
There was a problem hiding this comment.
hello,
thanks for the PR! And sorry for the delayed review.
it seems there is some issue in my local setup so I can't verify the changes properly, so far I can reproduce the difference in size of the files as in debug_sizes.php.
would you mind copy pasting those lines in the PR description and dropping the tests/reproduction/ folder? The tests in there are better suited in the github actions similar to .github/workflows/integration-test.yml. Simlarly the LangRopeServiceTest and mock_server.log can be dropped too.
| // todo: app_api is always available now (composer update) | ||
| try { | ||
| $appApiFunctions = \OCP\Server::get(\OCA\AppAPI\PublicFunctions::class); | ||
| $appApiFunctions = $this->getAppApiFunctions(); |
There was a problem hiding this comment.
no need for this change, the method getAppApiFunctions() can be dropped too
| $file->getMtime(), | ||
| $file->getMimeType(), | ||
| ProviderConfigService::getDefaultProviderKey(), | ||
| (int)$fileSize, |
There was a problem hiding this comment.
this change should be done in lib/BackgroundJobs/SubmitContentJob.php too
| if ($userFolder instanceof File) { | ||
| $source = $this->getSourceFromFile($mimeTypeFilter, $userFolder); | ||
| if ($source !== null) { | ||
| $this->langRopeService->indexSources([$source]); | ||
| yield $source; | ||
| } | ||
| return []; | ||
| } | ||
|
|
There was a problem hiding this comment.
this should be in a separate PR
| public int|string $modified, | ||
| public string $type, | ||
| public string $provider, | ||
| public ?int $size = null, |
There was a problem hiding this comment.
| public ?int $size = null, | |
| public int $size, |
|
|
||
| $params = array_map(function (Source $source) { | ||
| $contents = $source->content; | ||
| if ($source->size !== null) { |
There was a problem hiding this comment.
this check would not be required after the size is always available in the Source class
|
btw, does the change let the documents that failed to index previously pass now, with a real (dev) setup? |
If the "nextcloud:latest" docker image counts as a "real dev setup", then yes. This code went from: To: So it shows on that image that it went from a state of not working with encryption to working, via a test performed by the run_test.sh script. |
|
Please note that this PR was mostly a proof of concept and not necessarily production ready code to merge. I am not a PHP developer and you can see that all of this code was developed by Google Jules AI with my guidance as a developer of other software languages. I think the main thing this PR shows is that |
|
If you agree with the results of this PR, I would ask you to please take the "ideas" from it and formalize them into a production ready release. I don't really have the project background or the PHP experience to do so. Please let me know if you need any more information or data from this debugging trial. Thanks! |
yes, it does but "Running Scan (Direct Indexing) on test.txt..." and other logs are from the test files which use a dummy context_chat_backend, not the real one. Setup instructions for which can be found here: https://github.com/nextcloud/context_chat_backend?tab=readme-ov-file#dev-install-with-docker on a different note, to cover our bases, can you post the output to this from the real instance? occ config:list context_chat | grep request_timeout
docker inspect <docker-socket-proxy-container-name/id> | grep TIMEOUT_SERVER |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
Fixes cURL Error 26 (SSE Size Mismatch) in Nextcloud Context Chat.
When SSE is enabled,
fstat()on a file handle returns the encrypted size, while reading the stream returns the decrypted content. This mismatch caused uploads to fail withcURL error 26because Guzzle usesfstatto calculate the requestContent-Length.This fix:
$file->getSize()) to theSourceobject.LangRopeService, wraps the file stream in a GuzzleFnStreamand overridesgetSize()to return the correct decrypted size. This forces Guzzle to advertise the correct length, matching the data streamed.Includes comprehensive reproduction scripts validating the fix against Nextcloud VFS encryption.
Test output before on commit: [f7c85cd]
Test output after on commit: [f7c85cd]