Saving a response to an existing file fails with an error
Closed this issue · 4 comments
Describe the bug
If a response is saved twice in a row with the same file path, an error occurs if an attempt is made to overwrite the existing file.
To Reproduce
Steps to reproduce the behavior:
- Go to
Response
from an executed request - Click on 'Save to file'
- Save as e.g
export.zip
- Repeat step 1 to 3
- Confirm the message
export.zip already exists. Do you want to repalce it?
withYes
- The following error appears
System.IO.IOException: The file 'C:\temp\export.zip' already exists. at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite) at System.IO.Abstractions.FileWrapper.Copy(String sourceFileName, String destFileName) at Kreya.Data.FileSystem.FileService.Copy(String sourcePath, String targetPath) at Kreya.Rest.Core.Operations.RestResponseLoader.SaveResponseToFile(String responseLocation, String fileLocation, RestResponseContentType contentType, RestResponseFormat format) at SpiderEye.Bridge.ApiMethod.InvokeAsync(Object instance, Object parameter) at SpiderEye.Bridge.WebviewBridge.InvokeWithDependencyInjection(IDependencyInjectionApiMethod apiMethod, Object parameters) at SpiderEye.Bridge.WebviewBridge.InvokeWithDependencyInjection(IDependencyInjectionApiMethod apiMethod, Object parameters) at SpiderEye.Bridge.WebviewBridge.ResolveCall(String id, String parameters)
Expected behavior
The existing file should be overwritten after confirmation.
Environment
{
"kreyaVersion": "1.14.0",
"releaseChannel": "stable",
"osDescription": "Microsoft Windows 10.0.19045",
"osVersion": "Microsoft Windows NT 10.0.19045.0",
"osArch": "X64",
"processArch": "X64",
"runtimeIdentifier": "win-x64",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0"
}
This has been fixed in the latest beta version and will be released in the next stable version
@ni507 I have switched to the beta branch to verify the latest release. It seems not to be working on my side. As expected the error message does not appear anymore when overwriting an existing file but the overridden file is not actually replaced. The file content and timestamp remains old.
I would like to provide you with additional logs. Where does Kreya store application logs?
@ni507 My previous answer is not correct. Overwriting an existing file works as expected 👍. I have not created a new request and thus, the previous response has been written to the filesystem (as expected). After re-executing the requests, the response has been successfully updated including its timestamp.
Kreya 1.15 has just been released, which fixes this bug.