github-tools / github-tools/github
Write Image to GitRepo
- 主要言語
- JavaScript
- スター
- 3.8k
- フォーク
- 809
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I am trying to upload an Image to GitHub from the browser. I download the image into a blob, convert the blob into base64 and the use the writeFile method. However, the data never arrives correctly in GitHub.
```JS
fetch(url).then(response => response.blob().then(blob => {
let reader = new FileReader();
reader.onloadend = () => {
var base64result = reader.result.substr(reader.result.indexOf(',') + 1);
let fileName = this.getFileName(image.url)
repository.writeFile(this.github.branch, fileName, base64result, 'Quant-UX Export').then(result => {
resolve(result)
})
}
reader.readAsDataURL(blob);
}))
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Start by tracing the repository.writeFile call in the browser wrapper and compare its handling of the base64result produced by FileReader. Reproduce the image upload with the shown fetch and writeFile sequence; done means the uploaded image arrives correctly in GitHub.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100