riok / Kreya

Kreya is a GUI client for gRPC and REST APIs with innovative features for environments, authorizations and more.
https://kreya.app
279 stars 5 forks source link

Saving a response to an existing file fails with an error #232

Closed jgoelten closed 3 weeks ago

jgoelten commented 1 month ago

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:

  1. Go to Response from an executed request
  2. Click on 'Save to file'
  3. Save as e.g export.zip
  4. Repeat step 1 to 3
  5. Confirm the message export.zip already exists. Do you want to repalce it? with Yes
  6. 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"
    }
ni507 commented 1 month ago

This has been fixed in the latest beta version and will be released in the next stable version

jgoelten commented 1 month ago

@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?

jgoelten commented 1 month ago

@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.

CommonGuy commented 3 weeks ago

Kreya 1.15 has just been released, which fixes this bug.