Skip to content

Commit

Permalink
Merge pull request #48 from yar229/develop
Browse files Browse the repository at this point in the history
fixed renaming within Total Commander WebDAV plugin;
cloud.mail.ru client updated;
  • Loading branch information
yar229 authored Jan 9, 2017
2 parents c1eebd7 + 974d323 commit 19d086a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
21 changes: 20 additions & 1 deletion WebDavMailRuCloudStore/Mailru/MoveHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public async Task<bool> HandleRequestAsync(IHttpContext httpContext, IStore stor
}

// Obtain the destination
var destinationUri = request.GetDestinationUri();
//var destinationUri = request.GetDestinationUri();
var destinationUri = GetDestinationUri(request);
if (destinationUri == null)
{
// Bad request
Expand Down Expand Up @@ -100,6 +101,24 @@ public async Task<bool> HandleRequestAsync(IHttpContext httpContext, IStore stor
return true;
}

private static Uri GetDestinationUri(IHttpRequest request)
{
// Obtain the destination
string destinationHeader = request.GetHeaderValue("Destination");

if (destinationHeader == null)
return null;

// Create the destination URI
var uri = destinationHeader.StartsWith("/")
? new Uri(request.Url, destinationHeader)
: new Uri(destinationHeader);

return uri;
}



private async Task MoveAsync(IStoreCollection sourceCollection, string sourceName, IStoreCollection destinationCollection, string destinationName, bool overwrite, IHttpContext httpContext, Uri baseUri, UriResultCollection errors)
{
// Determine the new base URI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public MailruStoreCollection(ILockingManager lockingManager, Folder directoryInf

new DavQuotaAvailableBytes<MailruStoreCollection>
{
Getter = (context, collection) => collection.FullPath == "/" ? Cloud.Instance.GetQuota().Result.Free : long.MaxValue,
Getter = (context, collection) => collection.FullPath == "/" ? Cloud.Instance.Account.GetDiskUsage().Result.Free.DefaultValue : long.MaxValue,
IsExpensive = true //folder listing performance
},

new DavQuotaUsedBytes<MailruStoreCollection>
{
Getter = (context, collection) => collection.FullPath == "/" ? Cloud.Instance.GetQuota().Result.Used : long.MaxValue,
Getter = (context, collection) => collection.FullPath == "/" ? Cloud.Instance.Account.GetDiskUsage().Result.Used.DefaultValue : long.MaxValue,
IsExpensive = true //folder listing performance
},

Expand Down

0 comments on commit 19d086a

Please sign in to comment.