Repository navigation
fix(files_external): reset EOF when seeking in SFTPReadStream - #66002
Merged
provokateurin merged 1 commit intoNov 3, 2026
Merged
provokateurin merged 1 commit into
provokateurin merged 1 commit into
Conversation
susnux
requested review from
a team,
icewind1991,
leftybournes and
salmart-dev
and removed request for
a team
October 29, 2026 12:40
Contributor
|
/backport to stable35 |
Contributor
Author
|
The remaining failure in "No DB unit tests (PHP 8.3)" is in core tests ( |
Member
|
The failing preview test was fixed on master. Could you rebase your PR? |
Once a read reached the end of the remote file, the eof flag stayed set after a seek, and every later read returned an empty string. The movie preview reads the moov atom at the end of a video and then copies the file from the start, so the sparse file was all zeros and ffmpeg failed. Fixes nextcloud#66001 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tiago Carrondo <tiago@carrondo.pt>
tcarrondo
force-pushed
the
fix/sftp-read-stream-seek-after-eof
branch
from
November 3, 2026 00:48
48581e1 to
c39dcd5
Compare
provokateurin
approved these changes
Nov 3, 2026
provokateurin
enabled auto-merge
November 3, 2026 06:45
|
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
SFTPReadStream::seekTo()resets the positions and the buffer, but not$this->eof. After a read has reached the end of the remote file, a seek reports success, yet every later read returns an empty string.OC\Preview\Movie::getSparseFile()runs into this on SFTP storage: it reads themoovatom at the end of the video, seeks back to 0 and copies the start of the file, which copies 0 bytes. ffmpeg then gets a sparse file of zeros, and the preview fails on every request.This PR clears the flag in
seekTo()and adds unit tests forSFTPReadStream, with a fake server stubbed at theSFTPReflectionseam, as inSFTPWriteStreamTest.testSeekBackAfterEoffails without the fix.Checked on a 35.0.2 instance with an SFTP mount. Before: the movie preview failed for two MP4s (11 and 18 MB,
moovat the end), and the sparse file was all zeros. With the fixed class loaded: both previews are generated.TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)
🤖 Generated with Claude Code