diff --git a/BrowseRouter/Model/Args.cs b/BrowseRouter/Model/Args.cs
index b630cc0..17122d0 100644
--- a/BrowseRouter/Model/Args.cs
+++ b/BrowseRouter/Model/Args.cs
@@ -22,6 +22,15 @@ public static (string, string) SplitPathAndArgs(string s)
return (path, args);
}
+ // If not quoted, split on first space to separate path from args
+ int spaceIndex = s.IndexOf(' ');
+ if (spaceIndex > 0)
+ {
+ string path = s[..spaceIndex];
+ string args = s[(spaceIndex + 1)..];
+ return (path, args);
+ }
+
// The single executable without any other arguments.
return (s, "");
}
diff --git a/Directory.Build.props b/Directory.Build.props
index dddcd21..3916300 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -5,7 +5,7 @@
enable
enable
latest
- 0.17.1
+ 0.18.0
BrowseRouter
EnduraByte LLC 2022-2025
diff --git a/Tests/BrowseRouter.Tests/ArgsTests/GetPathAndArgsMethod.cs b/Tests/BrowseRouter.Tests/ArgsTests/GetPathAndArgsMethod.cs
index 94096d3..7b21adc 100644
--- a/Tests/BrowseRouter.Tests/ArgsTests/GetPathAndArgsMethod.cs
+++ b/Tests/BrowseRouter.Tests/ArgsTests/GetPathAndArgsMethod.cs
@@ -55,4 +55,31 @@ public void ReturnsInputAsPath_WhenInputContainsInvalidQuotes()
// Assert
result.Should().Be((input, ""));
}
+
+ [Fact]
+ public void SplitsUnquotedPathWithArgs_OnFirstSpace()
+ {
+ // Arrange - Issue #94: User wants to pass args with {url} tag to browser
+ // e.g., "firefox.exe ext+container:name=Work&url={url}"
+ string input = "firefox.exe ext+container:name=Work&url={url}";
+
+ // Act
+ var result = Args.SplitPathAndArgs(input);
+
+ // Assert - Should split on first space, treating rest as args
+ result.Should().Be(("firefox.exe", "ext+container:name=Work&url={url}"));
+ }
+
+ [Fact]
+ public void SplitsUnquotedPathWithArgs_PreservesMultipleArgs()
+ {
+ // Arrange
+ string input = "firefox.exe --new-window --url {url}";
+
+ // Act
+ var result = Args.SplitPathAndArgs(input);
+
+ // Assert
+ result.Should().Be(("firefox.exe", "--new-window --url {url}"));
+ }
}
\ No newline at end of file
diff --git a/Tests/BrowseRouter.Tests/Services/BrowserServiceTests.cs b/Tests/BrowseRouter.Tests/Services/BrowserServiceTests.cs
index e650e44..1cba065 100644
--- a/Tests/BrowseRouter.Tests/Services/BrowserServiceTests.cs
+++ b/Tests/BrowseRouter.Tests/Services/BrowserServiceTests.cs
@@ -34,4 +34,47 @@ public async Task HandlesUrl(string url)
spy.LastPath.Should().Be("fake-browser.exe");
}
+
+ [Fact]
+ public async Task SubstitutesUrlTagInUnquotedBrowserArgs()
+ {
+ // Issue #94: User configures browser with args containing {url} tag
+ // e.g., for Firefox containers: "firefox.exe ext+container:name=Work&url={url}"
+ var config = BrowseRouter.Config.Config.Empty with
+ {
+ Browsers = new Dictionary
+ {
+ ["ff-work"] = "firefox.exe ext+container:name=Work&url={url}",
+ },
+ };
+ CatchAllConfig.AddTo(config);
+
+ var spy = new SpyProcessService();
+ await new BrowserService(new ConfigService(config), new EmptyNotifyService(), spy)
+ .LaunchAsync("https://example.com/path", "Fake Window");
+
+ spy.LastPath.Should().Be("firefox.exe");
+ spy.LastArgs.Should().Be("ext+container:name=Work&url=https://example.com/path");
+ }
+
+ [Fact]
+ public async Task SubstitutesUrlTagInQuotedBrowserArgs()
+ {
+ // When browser path is quoted, args with {url} should still work
+ var config = BrowseRouter.Config.Config.Empty with
+ {
+ Browsers = new Dictionary
+ {
+ ["ff-work"] = "\"firefox.exe\" ext+container:name=Work&url={url}",
+ },
+ };
+ CatchAllConfig.AddTo(config);
+
+ var spy = new SpyProcessService();
+ await new BrowserService(new ConfigService(config), new EmptyNotifyService(), spy)
+ .LaunchAsync("https://example.com/path", "Fake Window");
+
+ spy.LastPath.Should().Be("firefox.exe");
+ spy.LastArgs.Should().Be("ext+container:name=Work&url=https://example.com/path");
+ }
}
\ No newline at end of file