github-tools / github-tools/github

Write Image to GitRepo

Aberta
#655 0 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
JavaScript
Estrelas
3.8k
Forks
809
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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);
}))
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript
Domínio
api
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
35/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.