Repository: TabbyML/tabby
File: crates/tabby-common/src/config.rs (Rust)

Code before:
            model_name = "Qwen2-1.5B-Instruct"
            "#;

        let config: Config =
            serdeconv::from_toml_str::<Config>(toml_config).expect("Failed to parse config");

        if let Err(e) = Config::validate_model_config(&config.model.completion) {
            println!("Final result: {}", e);
        }

        assert!(
            matches!(Config::validate_model_config(&config.model.completion), Err(ref _e) if true)
        );
        assert!(Config::validate_model_config(&config.model.chat).is_ok());
    }

    #[test]
    fn test_resolve_dir_handles_various_file_urls() {
        use std::env;
        use std::path::PathBuf;

        // Detect current OS
        let is_windows = cfg!(windows);

        // Define various test cases for file:// URLs and their expected path suffixes
        let test_cases = vec![
            // Standard Unix-style file URL
            (
                "file:///home/user/project",
                PathBuf::from("/home/user/project"),
            ),
            // Standard Windows-style file URL (forward slashes)
            (
                "file:///C:/Users/test/project",
                PathBuf::from(r"C:\Users\test\project"),
            ),
            // Lowercase drive letter (still valid on Windows)
            (
                "file:///c:/Users/test/project",
                PathBuf::from(r"C:\Users\test\project"),
            ),
            // File URL with trailing slash
            (
                "file:///C:/Users/test/project/",
                PathBuf::from(r"C:\Users\test\project"),
            ),
            // URL with encoded characters (e.g., spaces)
            (
                "file:///C:/Users/test/My%20Project",
                PathBuf::from(r"C:\Users\test\My Project"),
            ),

Review comment (suggestion):
```suggestion
        // Define various test cases for file:// URLs and their expected path suffixes
        #[cfg(windows)]
        let test_cases = vec![]
        
        #[cfg(unix)]
        let test_cases = vec![]
```

Code after:

        let config: Config =
            serdeconv::from_toml_str::<Config>(toml_config).expect("Failed to parse config");

        if let Err(e) = Config::validate_model_config(&config.model.completion) {
            println!("Final result: {}", e);
        }

        assert!(
            matches!(Config::validate_model_config(&config.model.completion), Err(ref _e) if true)
        );
        assert!(Config::validate_model_config(&config.model.chat).is_ok());
    }
    #[test]
    #[cfg(windows)]
    fn test_resolve_dir_handles_various_file_urls_windows() {
        use std::path::PathBuf;

        let test_cases = vec![
            // Standard Windows-style file URL (forward slashes)
            (
                "file:///C:/Users/test/project",
                PathBuf::from(r"C:\Users\test\project"),
            ),
            // Lowercase drive letter
            (
                "file:///c:/Users/test/project",
                PathBuf::from(r"C:\Users\test\project"),
            ),
            // Trailing slash
            (
                "file:///C:/Users/test/project/",
                PathBuf::from(r"C:\Users\test\project"),
            ),
            // Encoded characters
            (
                "file:///C:/Users/test/My%20Project",
                PathBuf::from(r"C:\Users\test\My Project"),
            ),
            // .git repo
            (
                "file:///C:/Users/test/project.git",
                PathBuf::from(r"C:\Users\test\project.git"),
            ),
            // Multiple slashes
            (
                "file:////C:/Users/test/project",
                PathBuf::from(r"C:\Users\test\project"),
            ),
            // original issue case
            (