Title: Repository.writeFile fails if no options object is passed · Issue #577 · github-tools/github · GitHub
Open Graph Title: Repository.writeFile fails if no options object is passed · Issue #577 · github-tools/github
X Title: Repository.writeFile fails if no options object is passed · Issue #577 · github-tools/github
Description: In the documentation about Repository.writeFile, the options parameter is specified as optional. Despite this, the function fails if no options object is passed and throws this error: TypeError: Cannot read property 'encode' of undefined...
Open Graph Description: In the documentation about Repository.writeFile, the options parameter is specified as optional. Despite this, the function fails if no options object is passed and throws this error: TypeError: Ca...
X Description: In the documentation about Repository.writeFile, the options parameter is specified as optional. Despite this, the function fails if no options object is passed and throws this error: TypeError: Ca...
Opengraph URL: https://github.com/github-tools/github/issues/577
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Repository.writeFile fails if no options object is passed","articleBody":"In the [documentation](http://github-tools.github.io/github/docs/3.1.0/Repository.html#writeFile) about `Repository.writeFile`, the `options` parameter is specified as optional. Despite this, the function fails if no `options` object is passed and throws this error:\r\n```\r\nTypeError: Cannot read property 'encode' of undefined\r\n at Repository.writeFile (/Users/lucasantchougov/Documents/Work/oauth-rule-manager/node_modules/github-api/dist/components/Repository.js:941:37)\r\n at GitHubRuleManager.commitWorkspace (/Users/lucasantchougov/Documents/Work/oauth-rule-manager/lib/rule_managers/github-rule-manager.js:143:18)\r\n at /Users/lucasantchougov/Documents/Work/matey/matey-server/app.js:74:25\r\n at Layer.handle [as handle_request] (/Users/lucasantchougov/Documents/Work/matey/matey-server/node_modules/express/lib/router/layer.js:95:5)\r\n at next (/Users/lucasantchougov/Documents/Work/matey/matey-server/node_modules/express/lib/router/route.js:137:13)\r\n at Route.dispatch (/Users/lucasantchougov/Documents/Work/matey/matey-server/node_modules/express/lib/router/route.js:112:3)\r\n at Layer.handle [as handle_request] (/Users/lucasantchougov/Documents/Work/matey/matey-server/node_modules/express/lib/router/layer.js:95:5)\r\n at /Users/lucasantchougov/Documents/Work/matey/matey-server/node_modules/express/lib/router/index.js:281:22\r\n at param (/Users/lucasantchougov/Documents/Work/matey/matey-server/node_modules/express/lib/router/index.js:354:14)\r\n at param (/Users/lucasantchougov/Documents/Work/matey/matey-server/node_modules/express/lib/router/index.js:365:14)\r\n```\r\n\r\nThe error seems to get thrown when `options.encode` is read in `Repository.writeFile`. It only works for me when passing an empty object. This should be better documented or a default empty object should be instantiated in the method.","author":{"url":"https://github.com/lantchou","@type":"Person","name":"lantchou"},"datePublished":"2019-08-09T10:09:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/577/github/issues/577"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:03143956-869c-856e-bb90-15fbc60ca7eb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7E8:1059D2:32B42FC:43BB11D:6971DD9A |
| html-safe-nonce | e39115a65f06999bf49d35735a21698682a879c2baacf9059e8eb00ba739daca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0U4OjEwNTlEMjozMkI0MkZDOjQzQkIxMUQ6Njk3MUREOUEiLCJ2aXNpdG9yX2lkIjoiMjE4NDAxODc1OTAwNzcyMjkwNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e75af75383ae32b93dd3ff0098f26a55e0d618796388c07f59fb8a0021801368 |
| hovercard-subject-tag | issue:478908626 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github-tools/github/577/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7db81a37ad959f20e3f68fde747d705c5e9a8934b16bc6e18227f0a4d826b812/github-tools/github/issues/577 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7db81a37ad959f20e3f68fde747d705c5e9a8934b16bc6e18227f0a4d826b812/github-tools/github/issues/577 |
| og:image:alt | In the documentation about Repository.writeFile, the options parameter is specified as optional. Despite this, the function fails if no options object is passed and throws this error: TypeError: Ca... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lantchou |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7476eb4140129667a7530d10cfb7688f701883e35a4dcaa4673e3ec599af5199 |
| turbo-cache-control | no-preview |
| go-import | github.com/github-tools/github git https://github.com/github-tools/github.git |
| octolytics-dimension-user_id | 16116810 |
| octolytics-dimension-user_login | github-tools |
| octolytics-dimension-repository_id | 3640925 |
| octolytics-dimension-repository_nwo | github-tools/github |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3640925 |
| octolytics-dimension-repository_network_root_nwo | github-tools/github |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2cc0827c872b538cd08371730242ae4951d2d61a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width