summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2018-03-05 16:25:57 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2018-03-05 16:25:57 +0100
commitc7b3f969fc3fcf9d057a23638d121f51513bb13c (patch)
tree7b4a144d14874509834b72fba7f167d2d5ffc4e5
parent4a2ae8ab9ca4f0e0de978f982e44371047988e5d (diff)
downloadgitlab-c7b3f969fc3fcf9d057a23638d121f51513bb13c.tar.gz
[docs] Commits: add an example of binary file creation
Binary files need to be encoded in base64. Fixes #427
-rw-r--r--docs/gl_objects/commits.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/docs/gl_objects/commits.py b/docs/gl_objects/commits.py
index f7e73e5..88d0095 100644
--- a/docs/gl_objects/commits.py
+++ b/docs/gl_objects/commits.py
@@ -17,8 +17,15 @@ data = {
'actions': [
{
'action': 'create',
- 'file_path': 'blah',
- 'content': 'blah'
+ 'file_path': 'README.rst',
+ 'content': open('path/to/file.rst').read(),
+ },
+ {
+ # Binary files need to be base64 encoded
+ 'action': 'create',
+ 'file_path': 'logo.png',
+ 'content': base64.b64encode(open('logo.png').read()),
+ 'encoding': 'base64',
}
]
}