@@ -72,8 +72,11 @@ func githubConvertFiles(filesRaw map[interface{}]interface{}) map[string]map[str
7272 for k0 , v0 := range filesRaw {
7373 fileRaw := v0 .(map [interface {}]interface {})
7474 file := map [string ]string {}
75- for k1 , v1 := range fileRaw {
76- file [k1 .(string )] = string (v1 .([]uint8 ))
75+ if fileRaw ["content" ] != nil {
76+ file ["content" ] = string (fileRaw ["content" ].([]uint8 ))
77+ }
78+ if fileRaw ["filename" ] != nil {
79+ file ["filename" ] = string (fileRaw ["filename" ].([]uint8 ))
7780 }
7881 files [k0 .(string )] = file
7982 }
@@ -144,10 +147,10 @@ func githubCheckDescription(gist map[string]interface{}) bool {
144147func GithubGetGist (userId string , gistId string ) (interface {}, error ) {
145148 values := url.Values {}
146149 accessToken , err := getUserAttribute (userId , "oauth_token_gh" )
147- if err != nil {
148- return "error:oauth" , err
150+ // NOTE(brandyn): We allow the user to not have an oauth token for getting gists
151+ if err == nil {
152+ values .Set ("access_token" , accessToken )
149153 }
150- values .Set ("access_token" , accessToken )
151154 response , err := http .Get ("https://api.github.com/gists/" + gistId + "?" + values .Encode ())
152155 if err != nil {
153156 return "error:github" , err
0 commit comments