-
Notifications
You must be signed in to change notification settings - Fork 258
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: remote url in config is read as file #1830
fix: remote url in config is read as file #1830
Conversation
- fix: added check for url and if it's url then return url as is.
WalkthroughThe update enhances the configuration reader to handle both local and remote file paths, making the software more versatile. Additionally, it extends the main execution function to support advanced time and I/O operations, improving overall functionality for file handling. Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
src/config/reader.rs
Outdated
/// checks and returns valid path for caller function. | ||
fn resolve_path(src: &str, root_dir: Option<&Path>) -> String { | ||
if Path::new(&src).is_absolute() { | ||
if src.starts_with("http") || Path::new(&src).is_absolute() { |
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.
The update to resolve_path
to handle URLs starting with "http" is a necessary fix for the issue identified. Consider adding a unit test to ensure that URLs are correctly recognized and not treated as local paths.
Would you like me to help generate the unit testing code or open a GitHub issue to track this task?
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.
can we add some tests for this @ranjitmahadik
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.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
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.
@tusharmath sure, will add test cases for the change.
src/config/reader.rs
Outdated
@@ -213,10 +214,11 @@ impl ConfigReader { | |||
Ok(config_module) | |||
} | |||
|
|||
/// Checks if path is absolute else it joins file path with relative dir | |||
/// path | |||
/// checks and returns valid path for caller function. |
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 think the older documentation was more detailed.
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.
kept most of contents same and extended for urls, please let me know if this works for you or not.
/// Checks if path is a URL or absolute path, returns directly if so.
/// Otherwise, it joins file path with relative dir path.
Summary:
Issue Reference(s):
Fixes #1793
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>