From 63c453b930d53f0b08a88586e72a6dc6db0fcc08 Mon Sep 17 00:00:00 2001 From: Sergey Radich Date: Wed, 6 Jul 2022 10:31:15 +0200 Subject: [PATCH 1/2] Fixed migration of reports with dot in name --- .../ssrs-migration-rss/ssrs_migration.rss | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss b/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss index 356c07e5..3393799b 100644 --- a/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss +++ b/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss @@ -948,11 +948,12 @@ End Function 'Helper function to construct correctly formatted filename Function GetSnkFilename(srcFilename As String, type As String) As String - Dim hasFE As Boolean = HasFileExtension(srcFilename) - If SnkIsNative And hasFE And Not GetExtension(type) = "" Then 'Cut off file extension, if present + Dim currentFE As String = GetFileNameExtension(srcFilename) + + If SnkIsNative And (GetExtension(type) = currentFE) and currentFE <> "" Then 'Cut off file extension, if present srcFilename = RemoveFileExtension(srcFilename) - ElseIf Not SnkIsNative And Not hasFE Then 'Add file extension, if not present + ElseIf Not SnkIsNative And currentFE = "" Then 'Add file extension, if not present srcFilename = srcFilename + GetExtension(type) End If @@ -960,9 +961,14 @@ Function GetSnkFilename(srcFilename As String, type As String) As String End Function 'Helper -Function HasFileExtension(filename As String) As Boolean - Dim index As Integer = filename.LastIndexOf(".") - Return index >= 0 And filename.Length - index <= 5 +Function GetFileNameExtension(filename As String) As String + Dim index as Integer = -1 + index = filename.LastIndexOf(".") + If index > 0 + Return filename.Substring(index) + Else + Return "" + End If End Function 'Helper From 44785c6f374bbd18eef4d79ba57475b4f1cc593d Mon Sep 17 00:00:00 2001 From: Sergey Radich Date: Mon, 18 Jul 2022 16:44:46 +0200 Subject: [PATCH 2/2] Corrected variable naming in accordance with comments --- .../ssrs-migration-rss/ssrs_migration.rss | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss b/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss index 3393799b..fa533897 100644 --- a/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss +++ b/samples/features/reporting-services/ssrs-migration-rss/ssrs_migration.rss @@ -948,12 +948,12 @@ End Function 'Helper function to construct correctly formatted filename Function GetSnkFilename(srcFilename As String, type As String) As String - Dim currentFE As String = GetFileNameExtension(srcFilename) + Dim currentFileExtension As String = GetFileNameExtension(srcFilename) - If SnkIsNative And (GetExtension(type) = currentFE) and currentFE <> "" Then 'Cut off file extension, if present + If SnkIsNative And (GetExtension(type) = currentFileExtension) and currentFileExtension <> "" Then 'Cut off file extension, if present srcFilename = RemoveFileExtension(srcFilename) - ElseIf Not SnkIsNative And currentFE = "" Then 'Add file extension, if not present + ElseIf Not SnkIsNative And currentFileExtension = "" Then 'Add file extension, if not present srcFilename = srcFilename + GetExtension(type) End If