From 19b0f10ed488148f08be8dace2cb5f6ea371cea4 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 4 Nov 2020 12:33:04 +0100 Subject: [PATCH] fix getUserImg con path relativo/assoluto --- MConnectSDK/Utils.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MConnectSDK/Utils.cs b/MConnectSDK/Utils.cs index 2cb54c4..64af534 100644 --- a/MConnectSDK/Utils.cs +++ b/MConnectSDK/Utils.cs @@ -919,7 +919,17 @@ namespace MConnectSDK try { string imgEncoded = Uri.EscapeDataString(imagePath); - string fullImgPath = pageURL + imgEncoded + "?alt=media"; + string fullImgPath = ""; + // se ho imagePath che inizia per http --> assoluto, altrimenti faccio un inserimento PRE della pageURL + if (imgEncoded.StartsWith("http")) + { + fullImgPath = imgEncoded + "?alt=media"; + } + else + { + fullImgPath = pageURL + imgEncoded + "?alt=media"; + } + using (Stream response = await cHttpClient.GetStreamAsync(fullImgPath).ConfigureAwait(false)) { //if()