Skip to content

Commit

Permalink
[main] remove double slash for endPointUrl (#2174)
Browse files Browse the repository at this point in the history
  • Loading branch information
siyuniu-ms authored Oct 13, 2023
1 parent 0e9df10 commit c09995a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion shared/AppInsightsCommon/src/ConnectionStringParser.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { arrReduce, objKeys } from "@microsoft/applicationinsights-core-js";
import { arrReduce, objKeys, strEndsWith } from "@microsoft/applicationinsights-core-js";
import { DEFAULT_BREEZE_ENDPOINT } from "./Constants";
import { ConnectionString, ConnectionStringKey } from "./Interfaces/ConnectionString";

Expand Down Expand Up @@ -37,6 +37,10 @@ export function parseConnectionString(connectionString?: string): ConnectionStri

// apply the default endpoints
result.ingestionendpoint = result.ingestionendpoint || DEFAULT_BREEZE_ENDPOINT;

if (strEndsWith(result.ingestionendpoint, "/")) {
result.ingestionendpoint = result.ingestionendpoint.slice(0,-1);
}
}

return result;
Expand Down
3 changes: 3 additions & 0 deletions tools/applicationinsights-web-snippet/src/snippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ declare var cfg:ISnippetConfig;
let conString = _parseConnectionString();
let iKey = conString[strConStringIKey] || aiConfig[strInstrumentationKey] || strEmpty;
let ingest = conString[strIngestionendpoint];
if (ingest && ingest.slice(-1) === "/"){
ingest = ingest.slice(0,-1);
}
let endpointUrl = ingest ? ingest + "/v2/track" : aiConfig.endpointUrl; // only add /v2/track when from connectionstring

let message = "SDK LOAD Failure: Failed to load Application Insights SDK script (See stack for details)";
Expand Down

0 comments on commit c09995a

Please sign in to comment.