Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileStation().CopyMove().StartAsync() only moves and can move when there are no brackets from URL #127

Open
lyellick opened this issue Jun 22, 2020 · 0 comments

Comments

@lyellick
Copy link

While debugging the StartAsync extension from CopyMove() method sending the StartParamters it would only move a file if I caught the 'start' method and removed any brackets in the URL. When testing with a single files to copy/move (remove_src: true/false) the process would only move. Setting remove_src: false would always result in a 'move'.

Note: The share name is a guid. Couldn't think of a name for testing and is not a weird glitch.

Directory Tree for '/8c47db36-cce9-4fff-b4b2-a5df3a6a' share:

  • recycle
  • Folder A
    • example.txt
  • root.txt

Workaround:

SynologyConnectionExtension.cs: Line 108

Addition starting after line 110:

if (method.Equals("start"))
                url = url.Replace("[", "").Replace("]", "");

Code Executing StartAsync(<StartParamters>):

[HttpPost]
[Route("CopyMove")]
public async Task<IActionResult> CopyMove([FromBody] CopyMoveParams.StartParameters parameters)
{
    ResultData<CopyMoveResults.IStartResult> start = new ResultData<CopyMoveResults.IStartResult>();

    if (parameters.Path != null)
    {
        if (parameters.Path.Count() == 1)
        {
            using (var syno = _serviceProvider.GetService<ISynologyConnection>())
            {
                var login = await syno.Api().Auth().LoginAsync();

                start = await syno.FileStation().CopyMove().StartAsync(parameters);

                var logout = await syno.Api().Auth().LogoutAsync();
            }

            return Json(start);
        }
        else
        {
            return Json(new { Success = false, Error = "Only one copy/move instance is supported at this time." });
        }
    }
    else
    {
        return Json(start);
    }
}

Thanks,

-- Lincoln

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant