You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While debugging the RenameAsync extension sending the RenameParamters it would only rename a file/directory if I caught the 'rename' method and removed any brackets in the URL. When testing with multiple files/directories to rename I would get the 408 error (No such file or directory).
To add there seems to be an additional issue when you do not set a additional parameter. The below work around removes a zero addition parameter if there are no additional parameters.
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:
[HttpPost]
[Route("Rename")]
public async Task<IActionResult> Rename([FromBody] RenameParameters parameters)
{
ResultData<RenameResult.IFileResult> renamed = new ResultData<RenameResult.IFileResult>();
if (parameters.Path != null && parameters.Name != null)
{
if (parameters.Additional == 0)
parameters.Additional = RenameAdditional.RealPath;
using (var syno = _serviceProvider.GetService<ISynologyConnection>())
{
var login = await syno.Api().Auth().LoginAsync();
renamed = await syno.FileStation().Rename().RenameAsync(parameters);
var logout = await syno.Api().Auth().LogoutAsync();
}
}
return Json(renamed);
}
Closing:
This is an awesome code base for working with the Synology api! Been learning A TON just looking through the code. I hope the above reproduction and workaround is helpful to fix/help me. I tried figuring out how to fix this and do a pull request, but to be honest the code base is more sophisticated than I am capable of. The workaround is all I could come up with.
Thanks,
-- Lincoln
The text was updated successfully, but these errors were encountered:
lyellick
changed the title
FileStation().Rename().RenameAync() only works with there is one item to rename and brackets removed from URL
FileStation().Rename().RenameAync() only works when there is one item to rename and brackets removed from URL
Jun 22, 2020
While debugging the
RenameAsync
extension sending theRenameParamters
it would only rename a file/directory if I caught the 'rename' method and removed any brackets in the URL. When testing with multiple files/directories to rename I would get the 408 error (No such file or directory).To add there seems to be an additional issue when you do not set a
additional
parameter. The below work around removes a zero addition parameter if there are no additional parameters.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:
Workaround:
SynologyConnectionExtension.cs: Line 108
Addition starting after line 110:
GenericGetDataFromApiAsync var json raw output when trying multiple paths with workaround:
URL:
Output:
Code Executing
RenameAsync(<RenameParamters>)
:Closing:
This is an awesome code base for working with the Synology api! Been learning A TON just looking through the code. I hope the above reproduction and workaround is helpful to fix/help me. I tried figuring out how to fix this and do a pull request, but to be honest the code base is more sophisticated than I am capable of. The workaround is all I could come up with.
Thanks,
-- Lincoln
The text was updated successfully, but these errors were encountered: