github-tools / github-tools/github

Allow binary blobs

Open
#23 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
3.8k
Forks
809
PR merge metrics
No merged PRs in 30d

Description

In order to safely transfer binary blobs/filtes, the API needs to use base64 encoding when appropriate. postBlob() however always uses "utf-8". So there needs to be either an additional argument in write() and postBlob() that specifies the encoding, or postBlob() needs to detect if the file is binary or not, and adjust the encoding automatically.

This little snippet seems to be able to detect binary data:

```
/[\x00-\x08\x0E-\x1F]/.test(data)
```

See http://stackoverflow.com/questions/1677644/detect-non-printable-characters-in-javascript

I'm currently dealing with similar issues in Prose: https://github.com/prose/prose/pull/255

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the postBlob() and write() entry points and inspect how they currently choose UTF-8 encoding. Determine how binary data should be identified or explicitly encoded, then verify that binary blobs transfer safely while existing text uploads retain their current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.