From e0a998bde379567729e4eb6629e213464f5fad94 Mon Sep 17 00:00:00 2001 From: Ravinder Jangra Date: Thu, 25 Jul 2019 18:35:56 +0530 Subject: [PATCH] fix/browser: update webfetch to load content from url with long path --- .../WebFetchImplementation/WebFetch.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/SafeMobileBrowser/SafeMobileBrowser/WebFetchImplementation/WebFetch.cs b/SafeMobileBrowser/SafeMobileBrowser/WebFetchImplementation/WebFetch.cs index e63702da..40750173 100644 --- a/SafeMobileBrowser/SafeMobileBrowser/WebFetchImplementation/WebFetch.cs +++ b/SafeMobileBrowser/SafeMobileBrowser/WebFetchImplementation/WebFetch.cs @@ -65,9 +65,6 @@ private static string CreateFinalPath(string path) else finalPath = path; - Logger.Info($"Input path: {path}"); - Logger.Info($"final path: {finalPath}"); - return finalPath; } @@ -89,15 +86,10 @@ public async Task<(MDataInfo, string)> WebFetchHelper(string url) hostParts.Remove(publicName); var serviceName = string.Join(".", hostParts); - Logger.Info($"Public Name: {publicName}"); - Logger.Info($"Service Name: {serviceName}"); - // let's decompose and normalise the path var path = parsedUrl.AbsolutePath == "/" ? string.Empty : parsedUrl.AbsolutePath; var parsedPath = string.IsNullOrEmpty(path) ? string.Empty : System.Web.HttpUtility.UrlDecode(path); - Logger.Info($"Parsed Path: {parsedPath}"); - var mdataInfo = await GetContainerFromPublicId(publicName, serviceName); return (mdataInfo, parsedPath); @@ -199,7 +191,7 @@ void HandleNFSFetchException(FfiException exception) { try { - filePath = initialPath.Replace("/", string.Empty); + filePath = initialPath.Substring(1, initialPath.Length - 1); (file, _) = await _session.NFS.DirFetchFileAsync(fileMdInfo, filePath); } catch (Exception ex) @@ -227,7 +219,8 @@ void HandleNFSFetchException(FfiException exception) { try { - filePath = $"{initialPath}/{WebFetchConstants.IndexFileName}".Replace("/", string.Empty); + filePath = $"{initialPath}/{WebFetchConstants.IndexFileName}"; + filePath = filePath.Substring(1, filePath.Length - 1); (file, _) = await _session.NFS.DirFetchFileAsync(fileMdInfo, filePath); } catch (Exception ex)