Skip to content

Commit

Permalink
fix/browser: update webfetch to load content from url with long path
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinderjangra committed Jul 25, 2019
1 parent ffcfc12 commit e0a998b
Showing 1 changed file with 3 additions and 10 deletions.
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e0a998b

Please sign in to comment.