Skip to content

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

@lyellick

Description

@lyellick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions