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

On-Premises IFD configuration constructs invalid URL by appending /ORG #375

Open
janis-veinbergs opened this issue Oct 19, 2023 · 0 comments
Labels
good first issue Good for newcomers

Comments

@janis-veinbergs
Copy link

janis-veinbergs commented Oct 19, 2023

When connected via XTB to On-Premises instance via IFD URL, open record constructs invalid URL - it appends organization name but it should not.

Looks like ConnectionDetails has UseIfd property available.

Other properties could also be used: UseOnline which already checks if connecting to .dynamics.com

I suspect UseIfd will be false anyway for oauth - maybe it could just check if for onprem instances /organization is equals to domain first part, then strip org. Dunno if there could be any consequences.

public static string GetFullWebApplicationUrl(this ConnectionDetail connectiondetail)
{
var url = connectiondetail.WebApplicationUrl;
if (string.IsNullOrEmpty(url))
{
url = connectiondetail.ServerName;
}
if (!url.ToLower().StartsWith("http"))
{
url = string.Concat("http://", url);
}
var uri = new Uri(url);
if (!uri.Host.EndsWith(".dynamics.com"))
{
if (string.IsNullOrEmpty(uri.AbsolutePath.Trim('/')))
{
uri = new Uri(uri, connectiondetail.Organization);
}
}
return uri.ToString();
}

Perhaps replacing

!uri.Host.EndsWith(".dynamics.com")

with

!connectiondetail.UseIfd && !connectiondetail.UseOnline

Would be a good improvement.

@MarkMpn MarkMpn added the good first issue Good for newcomers label Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants