Skip to content

๐Ÿ› [BUG] - uploadFiles() cannot upload image files as it isย #58

@bentshrimp

Description

@bentshrimp

Browsers

Chrome

OS

Linux

Description

uploadFiles() has four steps

  1. get the branch data including current commit hash
  2. add files into the tree
  3. create a new commit
  4. update the branch

At the second step, tree parameter is supposed to get different mode depend on the file type.
๋‘๋ฒˆ์งธ ๋‹จ๊ณ„์—์„œ, tree ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ํŒŒ์ผ์˜ ์œ ํ˜•์— ๋‹ค๋ผ ๋‹ค๋ฅธ mode ๊ฐ’์„ ๊ฐ€์ ธ์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Reasons

      // add files into the tree
      const tree = await octokit.rest.git.createTree({
        owner: userName,
        repo: repoName,
        base_tree: baseTree,
        tree: files.map((file) => ({
          path: file.path,
          content: file.content,
          mode: '100644',
        })),
      });

It is a problem that when image file is added, the file goes broken.
์˜ˆ๋ฅผ ๋“ค๋ฉด ์ด๋ฏธ์ง€ ํŒŒ์ผ์„ ์˜ฌ๋ฆฌ๋ฉด, ํŒŒ์ผ์ด ๊นจ์ง€๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.
We should fix it so that it can add any types of files.
์–ด๋–ค ์œ ํ˜•์˜ ํŒŒ์ผ์ด๋“  ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ณ ์ณ์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Reproduction URL

localhost:8080/

Reproduction Steps

1. Add a function that check if file is image
์ด๋ฏธ์ง€ ํŒŒ์ผ์ธ์ง€ ํ™•์ธํ•˜๋Š” ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ ๋‹ค.
2. Figure out how to add image file as it is. NOT AS STRING.
์–ด๋–ป๊ฒŒ ์ด๋ฏธ์ง€ ํŒŒ์ผ์„ ์žˆ๋Š” ๊ทธ๋Œ€๋กœ ์˜ฌ๋ฆด์ง€ ์•Œ์•„๋‚ธ๋‹ค. ๋ฌธ์ž์—ด๋กœ๊ฐ€ ์•„๋‹ˆ๋ผ.

Solutions

No response

Screenshots

![DESCRIPTION](LINK.png)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions