Skip to content

Commit 544e569

Browse files
author
Stewart Miles
committed
Fixed minor issues with path reporting in the measurement module.
In some cases paths are being reported with duplicate separators and spaced query strings which makes it harder to browse the data. This strips out extraneous separators from paths and trims all key / value pairs when generating query strings to report. Change-Id: I2581618a5441eb4381ddd21bf3324973c76df210
1 parent cd6a46e commit 544e569

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

source/VersionHandlerImpl/src/EditorMeasurement.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ public void Report(string reportUrl, ICollection<KeyValuePair<string, string>> p
426426
var queryComponents = new List<string>();
427427
foreach (var kv in parameters) {
428428
// URL escape keys and values.
429-
queryComponents.Add(String.Format("{0}={1}", Uri.EscapeDataString(kv.Key),
430-
Uri.EscapeDataString(kv.Value)));
429+
queryComponents.Add(String.Format("{0}={1}", Uri.EscapeDataString(kv.Key).Trim(),
430+
Uri.EscapeDataString(kv.Value).Trim()));
431431
}
432432
reportUrl = reportUrl + "?" + String.Join("&", queryComponents.ToArray());
433433
}
@@ -454,6 +454,8 @@ public void Report(string reportUrl, string reportName) {
454454
var fragment = uri.Fragment;
455455
if (!String.IsNullOrEmpty(BasePath)) path = BasePath + path;
456456
if (!String.IsNullOrEmpty(BaseReportName)) reportName = BaseReportName + reportName;
457+
// Strip all extraneous path separators.
458+
while (path.Contains("//")) path = path.Replace("//", "/");
457459
foreach (var cookie in
458460
new KeyValuePair<string, string>[] {
459461
new KeyValuePair<string, string>(Cookie, queryPrefix + "project"),
@@ -482,7 +484,9 @@ public void Report(string reportUrl, string reportName) {
482484
if (status != null) reported = true;
483485
}
484486
if (reported) {
485-
logger.Log(String.Format("Reporting analytics data: {0} '{1}'", reportUrl, reportName),
487+
logger.Log(String.Format("Reporting analytics data: {0}{1}{2} '{3}'", path,
488+
String.IsNullOrEmpty(queryPrefix) ? "" : "?" + queryPrefix,
489+
fragment, reportName),
486490
level: LogLevel.Verbose);
487491
}
488492
}

0 commit comments

Comments
 (0)