Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LocalFileSystem with range request that ends beyond end of file #6751

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix windows
  • Loading branch information
kylebarron committed Nov 18, 2024
commit b1dd9b33a2f83ad873306e1af3ccdc904f490325
12 changes: 11 additions & 1 deletion object_store/src/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,17 @@ pub(crate) fn chunked_stream(
.boxed()
}

pub(crate) fn read_range(file: &mut File, path: &PathBuf, range: Range<usize>) -> Result<Bytes> {
pub(crate) fn read_range(
file: &mut File,
path: &PathBuf,
mut range: Range<usize>,
) -> Result<Bytes> {
#[cfg(target_os = "windows")]
{
let file_len = file.seek(SeekFrom::End(0))?;
range = range.start..range.end.min(file_len as usize);
}

let to_read = range.end - range.start;
let seek_idx = file
.seek(SeekFrom::Start(range.start as u64))
Expand Down
Loading