This commit is contained in:
vfedosevich 2015-03-11 05:37:55 -07:00
commit 92ba95648f
38 changed files with 828 additions and 401 deletions

View file

@ -9,5 +9,13 @@ namespace WebsitePanel.WebDav.Core.Extensions
{
return new Uri(paths.Aggregate(uri.AbsoluteUri, (current, path) => string.Format("{0}/{1}", current.TrimEnd('/'), path.TrimStart('/'))));
}
public static string ToStringPath(this Uri uri)
{
var hostStart = uri.ToString().IndexOf(uri.Host, System.StringComparison.Ordinal);
var hostLength = uri.Host.Length;
return uri.ToString().Substring(hostStart + hostLength, uri.ToString().Length - hostStart - hostLength);
}
}
}

View file

@ -260,7 +260,7 @@ namespace WebsitePanel.WebDav.Core
{
get
{
string displayName = _href.AbsoluteUri.Trim('/').Replace(_baseUri.AbsoluteUri.Trim('/'), "");
string displayName = _href.ToString().Trim('/').Replace(_baseUri.ToString().Trim('/'), "");
displayName = Regex.Replace(displayName, "\\/$", "");
Match displayNameMatch = Regex.Match(displayName, "([\\/]+)$");
if (displayNameMatch.Success)
@ -483,7 +483,7 @@ namespace WebsitePanel.WebDav.Core
{
_href = href;
var baseUrl = href.AbsoluteUri.Remove(href.AbsoluteUri.Length - href.Segments.Last().Length);
var baseUrl = href.ToString().Remove(href.ToString().Length - href.ToString().Trim('/').Split('/').Last().Length);
_baseUri = new Uri(baseUrl);
}

View file

@ -52,7 +52,7 @@ namespace WebsitePanel.WebDav.Core.Managers
Href = new Uri(x.Url),
ItemType = ItemType.Folder,
ContentLength = x.Size * 1024 * 1024,
AllocatedSpace = x.FRSMQuotaMB * 1024 * 1024,
AllocatedSpace = (long)x.FRSMQuotaMB * 1024 * 1024,
IsRootItem = true
}).ToArray();
}