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

Select format with URLs always returns default #45

Closed
Revarin opened this issue Oct 14, 2024 · 2 comments · Fixed by #46
Closed

Select format with URLs always returns default #45

Revarin opened this issue Oct 14, 2024 · 2 comments · Fixed by #46

Comments

@Revarin
Copy link

Revarin commented Oct 14, 2024

Select format does not seem to work correctly with text containing url. Formatter always returns default string no matter what arguments are passed. No exception or any other form of a warning is raised.

public void UrlTest()
{
    var mf= new MessageFormatter(locale: "en-US");

    IDictionary<string, object> dict = new Dictionary<string, object>
    {
        ["cond"] = "foo"
    };

    Assert.Equal("https://www.google.com/", mf.FormatMessage("{cond, select, foo{https://www.google.com/} other{https://www.bing.com/}}", dict));
}
Message: 
Assert.Equal() Failure: Strings differ

Expected: "https://www.google.com/"
Actual:   "https://www.bing.com/"

Formatter should either format the string correctly or throw an exception.

@jeffijoe
Copy link
Owner

That's odd, I'll take a look.

@jeffijoe
Copy link
Owner

Thanks for the report! MessageFormat v7.1.2 has been released with a fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants