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: github.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:d62128b1-8a8e-e2e3-fcf0-4b7edbbfd2d6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5EE:1FABE2:6AB120:8DB5EE:697311D1 |
| html-safe-nonce | e9921133ffbb279f9d0555b80f5794c7afcb8d2d3cef20bc055a687c635b33a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUVFOjFGQUJFMjo2QUIxMjA6OERCNUVFOjY5NzMxMUQxIiwidmlzaXRvcl9pZCI6IjE2MjE4Mzc3MDc4MTE2ODg5MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | aa49c966350b5b300437385bb8ec9bc7a64e0de05eb041611c051ee7942f2279 |
| 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 | 44ab3188c1dcfe3be0f9c3feca2e04e14fb79f120939ce2395e4f15ab96ec1d4 |
| 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 | a5e2b48bd1260476599758f5d253b5d24092ab84 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width