Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update Repository.js to works if png
Using the raw parameter within the options of the writeFile method, this tool works with the sending of png images, it has not been tested with other files, but I think this solution will work for others as well.

```
writePng(fileNamePng:string,base64Png:any,commitMsg:string=''){
    let initialMessage=commitMsg||'Commit de '+base64Png;
    let option = {encode:false,raw:true}
    const promise = this.bagRepo.writeFile('master', base64Png, base64Png, initialMessage, option);
    promise.then((valor:any) => {
      // console.log(valor);
    },this.initRepo);
    return promise;
  }
```
  • Loading branch information
wdison authored Apr 12, 2021
commit ba8604b9544ae12dd55f4046186df889b487e546
4 changes: 2 additions & 2 deletions lib/Repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,9 @@ class Repository extends Requestable {
return this.getSha(branch, filePath)
.then((response) => {
commit.sha = response.data.sha;
return this._request('PUT', `/repos/${this.__fullname}/contents/${filePath}`, commit, cb);
return this._request('PUT', `/repos/${this.__fullname}/contents/${filePath}`, commit, cb, options.raw);
}, () => {
return this._request('PUT', `/repos/${this.__fullname}/contents/${filePath}`, commit, cb);
return this._request('PUT', `/repos/${this.__fullname}/contents/${filePath}`, commit, cb, options.raw);
});
}

Expand Down