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

improve file path validation when reading parquet #8267

Merged
merged 4 commits into from
Nov 21, 2023

Conversation

Weijun-H
Copy link
Member

Which issue does this PR close?

Follow #8265

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

let file_path = path.as_str();
if (!file_path.ends_with(option_extension.clone().as_str())
&& !path.is_collection())
|| (!file_path.ends_with((option_extension.clone() + "/").as_str())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path separator here is platform-specific.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use std::path::MAIN_SEPARATOR instead here

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Weijun-H for a quick turnaround. Please add a test for double dots

bbb..bbb/filename.parquet

@@ -138,10 +138,10 @@ mod tests {
Ok(())
}

#[cfg(not(target_family = "windows"))]
Copy link
Member Author

@Weijun-H Weijun-H Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extend to all platforms

Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Weijun-H

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @Weijun-H

@alamb alamb merged commit 952e7c3 into apache:main Nov 21, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants