Potential fix for #326 #343
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It appears that the ObjectStore Storage implementation puts the file contents into the php temp stream, which is passed to the S3 uploader, which for whatever reason tries to reopen the underlying file of the stream, which happens to be the php temp stream, which is not reusable by passing its uri and is thus empty.
A quick fix, if the above theory is correct, would be to pass the contents as a stream to putContents(), which forces nextcloud to write the stream to disk in a temp file and thus avoids the failing S3 upload, as the aws uploader now has an actual file to work with instead of the temp stream.
I cannot test this myself, as I lack access to an S3 instance.
If this fix works, an upstream fix in nextcloud would be in order as well.
Fixes #326