Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base64 files are not well encoded #136

Open
tarekeldeeb opened this issue Mar 18, 2024 · 1 comment
Open

Base64 files are not well encoded #136

tarekeldeeb opened this issue Mar 18, 2024 · 1 comment

Comments

@tarekeldeeb
Copy link

I have used this plugin to successfully create PRs for many text-based files.
I tried to include an image, a file is created with the correct file size, but the content is not correct.

    octokit
      .createPullRequest({
        ..
        ..
        changes: [
          {           
           files: { 
                ["path/to/text/file/ok"]: 
                    `JSON.stringify(Ok_text_content)`,
                ["path/to/png/file/NOK"]: {
                    content: this.registerForm.value.image_file,
                    encoding: "base64",
                  }
            },
        ..
        })

Here I ran a diff to try to figure out the issue, but could not:
pr_bug

For sure, Github could not display the image in PR.

@gr2m
Copy link
Owner

gr2m commented Mar 18, 2024

is this.registerForm.value.image_file a base64 encoded string? How are you encoding it?

Here is a test for this feature as a reference:

content: "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",
encoding: "base64",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants