apache / camel-karavan

Apache Camel Karavan a Low-code Data Integration Platform
https://camel.apache.org
Apache License 2.0
436 stars 146 forks source link

Binary files are corrupted after downloaded from the project #1342

Closed mgubaidullin closed 2 days ago

mgubaidullin commented 2 months ago

Describe the bug

Binary files are corrupted after downloaded from the project

Steps to reproduce the behavior

  1. Upload file to the project
  2. Download file from the project

Variant

Web Application

Container Management (if applicable)

None

Operating System (if applicable)

None

Version

4.6.0

Relevant log output

No response

Anik-Bardhan commented 2 days ago

Hey @mgubaidullin. I think I spotted the issue for this.

function download(file: ProjectFile) {
        if (file) {
            const type = file.name.endsWith("yaml") ? "application/yaml;charset=utf-8" : undefined;
            const f = new File([file.code], file.name, {type: type});
            FileSaver.saveAs(f);
        }
    }

This code snippet is from FilesTab.tsx file. Here the construction of the File object needs to be handled differently for binary files. My guess is that for binary file.code needs to be converted into a BLOB type. Can I experiment on this idea? Can this ticket be assigned to me?

mgubaidullin commented 2 days ago

I am pretty sure that this is not the case. Files code stored as text everywhere in Karavan. It was designed like this because Karavan operates with source code of an application that finally stored in git.

I believe that is is not a good idea to store binary data in git. That is why this ticket was not implemented in 4.8.0