From 8b2517e7c529bb46f020ebbbccbcb36be005883b Mon Sep 17 00:00:00 2001 From: Patrik Billgren Date: Mon, 28 Nov 2022 14:19:22 +0100 Subject: [PATCH] Remove occurrences of single quotes in filenames Signed-off-by: Patrik Billgren --- Resources/js/app.js | 4 ++-- Sources/XCLogParser/generated/HtmlReporterResources.swift | 8 ++++---- Sources/XCLogParser/reporter/HtmlReporter.swift | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Resources/js/app.js b/Resources/js/app.js index a6b6260..d7c5bf2 100644 --- a/Resources/js/app.js +++ b/Resources/js/app.js @@ -545,10 +545,10 @@ function showWarnings(target) { function itemSelected(target, selectedItem) { if (selectedItem.type === 'target') { - const fileName = selectedItem.identifier.replaceAll(' ', '_'); + const fileName = selectedItem.identifier.replaceAll(' ', '_').replaceAll('\\\'', '_'); window.location.href = window.location.href.replace('index.html', fileName + '.html'); } else if (selectedItem.type === 'detail') { - const targetId = selectedItem.parentIdentifier.replaceAll(' ', '_'); + const targetId = selectedItem.parentIdentifier.replaceAll(' ', '_').replaceAll('\\\'', '_'); if (target === 'main') { const stepUrl = window.location.href.replace(encodeURI('{{file_name}}'), targetId + '.html'); window.location.href = stepUrl + "?step=" + selectedItem.identifier; diff --git a/Sources/XCLogParser/generated/HtmlReporterResources.swift b/Sources/XCLogParser/generated/HtmlReporterResources.swift index 7faf01c..6610aed 100644 --- a/Sources/XCLogParser/generated/HtmlReporterResources.swift +++ b/Sources/XCLogParser/generated/HtmlReporterResources.swift @@ -637,10 +637,10 @@ function showWarnings(target) { function itemSelected(target, selectedItem) { if (selectedItem.type === 'target') { - const fileName = selectedItem.identifier.replaceAll(' ', '_'); + const fileName = selectedItem.identifier.replaceAll(' ', '_').replaceAll('\\\'', '_'); window.location.href = window.location.href.replace('index.html', fileName + '.html'); } else if (selectedItem.type === 'detail') { - const targetId = selectedItem.parentIdentifier.replaceAll(' ', '_'); + const targetId = selectedItem.parentIdentifier.replaceAll(' ', '_').replaceAll('\\\'', '_'); if (target === 'main') { const stepUrl = window.location.href.replace(encodeURI('{{file_name}}'), targetId + '.html'); window.location.href = stepUrl + "?step=" + selectedItem.identifier; @@ -1046,7 +1046,7 @@ public static let indexHTML = - + @@ -1302,7 +1302,7 @@ public static let stepHTML = - + diff --git a/Sources/XCLogParser/reporter/HtmlReporter.swift b/Sources/XCLogParser/reporter/HtmlReporter.swift index fa459f2..c3b5925 100644 --- a/Sources/XCLogParser/reporter/HtmlReporter.swift +++ b/Sources/XCLogParser/reporter/HtmlReporter.swift @@ -125,6 +125,7 @@ public struct HtmlReporter: LogReporter { stepsWithErrors.append(contentsOf: getStepsWithErrors(target: target)) stepsWithWarnings.append(contentsOf: getStepsWithWarnings(target: target)) let targetName = target.identifier.replacingOccurrences(of: " ", with: "_") + .replacingOccurrences(of: "'", with: "_") let name = "\(targetName).js" let json = try encoder.encode(target.flatten()) guard let jsonString = String(data: json, encoding: .utf8) else {