@@ -98,13 +98,13 @@ public struct FSAppConfigurationAsync {
9898 private func getVersionFromConsul( by path: URI ) async throws -> String {
9999 try await self . app. client. get ( path) . map { response -> String in
100100 let dataValue = self . decode ( response, path)
101- let versionString = String ( decoding: dataValue, as: UTF8 . self)
101+ let versionString = String ( decoding: dataValue, as: UTF8 . self) . replacingOccurrences ( of : " \n " , with : " " )
102102 if versionString. isEmpty {
103103 self . app. logger. error ( " ERROR: Encoded empty value by ' \( path) ' in consul " )
104104 return " "
105105 } else {
106106 self . app. logger. info ( " SUCCESS: Encoded ' \( versionString) ' by ' \( path) ' from consul " )
107- return versionString. replacingOccurrences ( of : " \n " , with : " " )
107+ return versionString
108108 }
109109 } . get ( )
110110 }
@@ -171,12 +171,12 @@ public struct FSAppConfigurationAsync {
171171 self . app. logger. error ( " ERROR: Failed to load Version file at the file path - ' \( versionPath) ' " )
172172 fatalError ( " ERROR: Failed to load Version file at the file path - ' \( versionPath) ' " )
173173 }
174- guard let versionString = String ( data: versionValue, encoding: . utf8) , !versionString. isEmpty else {
174+ guard let versionString = String ( data: versionValue, encoding: . utf8) ? . replacingOccurrences ( of : " \n " , with : " " ) , !versionString. isEmpty else {
175175 self . app. logger. error ( " ERROR: Failed to encoding Version value from - ' \( versionValue) ' " )
176176 fatalError ( " ERROR: Failed to encoding Version value from - ' \( versionValue) ' " )
177177 }
178178 self . app. logger. info ( " SUCCESS: Get the Version - \( versionString) from the local machine along the file path \( versionPath) " )
179- return versionString. replacingOccurrences ( of : " \n " , with : " " )
179+ return versionString
180180 }
181181
182182 /// Decode Consul `ClientResponse`
0 commit comments