-
-
Notifications
You must be signed in to change notification settings - Fork 88
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: absolute url for windows #655
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
recheck |
PS: This is my first time writing Rust code so would love code review. |
server/src/storage/localfs.rs
Outdated
"{}", | ||
self.root.join(RelativePath::new(prefix).as_str()).display() | ||
)) | ||
object_store::path::Path::parse(format!("{}", self.root.join(prefix.as_str()).display()).trim_start_matches(std::path::MAIN_SEPARATOR), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rechecked and std::path::MAIN_SEPARATOR
seems like a better solution here.
@@ -212,7 +212,8 @@ impl ObjectStorage for LocalFS { | |||
|
|||
fn absolute_url(&self, prefix: &RelativePath) -> object_store::path::Path { | |||
object_store::path::Path::parse( | |||
format!("{}", self.root.join(prefix.as_str()).display()).trim_start_matches('/'), | |||
format!("{}", self.root.join(prefix.as_str()).display()) | |||
.trim_start_matches(std::path::MAIN_SEPARATOR), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using std::path::MAIN_SEPARATOR
is a better solution as it handles slashes accordingly.
@Delta456 do you have windows machine / have you tested this ? |
Yes, I have tested this on my Windows machine. |
Fixes #650
Description
Fixes #650.
UsesRelativePath::new
function for platform independent relative paths.EDIT: Uses
std::path::MAIN_SEPARATOR
instead of hardcore/
which handles slashes accordingly.This PR has: