github-api
github-api copied to clipboard
Accessing Gists via getMyself().listGists() returns null data for Gist files
Once I authenticate to GitHub with a valid access token, but then attempt to pull the Map of Gists using this method:
gitHub.getMyself().listGists();
It will give me a map of GHGist objects and their gistId's, but when I then use the GHGist object to pull the files out of Gist, the file data comes back null.
Edit: Here is some test code with the output if it helps:
System.out.println("GistID's from GHGist objects:");
for (GHGist ghGist : gitHub.getMyself().listGists().toList()) {
System.out.println("\t"+ghGist.getGistId());
}
System.out.println("\nFrom the same GHGist objects, here is the data that their GHGistFile objects contain:\n\nFilename: Content");
for (GHGist ghGist : gitHub.getMyself().listGists().toList()) {
for(GHGistFile ghGistFile : ghGist.getFiles().values()) {
System.out.print("\t"+ghGistFile.getFileName()+": ");
System.out.println(ghGistFile.getContent());
}
}
Output:
GistID's from GHGist objects:
9dc8a008611a40e94099b1c0b6863733
342f5623cf3df3661f46ebf4ca2a2675
c2f0e3c0e5db2d9ad4bcf330e07927fb
b8f9336f40e578c3592050a239bfdeb4
da95ba9977e6b41bbe4dd66091f90212
ee3699324888a1217615584e77e900ad
420cdb2f098acfbfa1d16846851e9de4
7902bc4639d0488a8f033b603072a842
79203c3de770580d82d445de62d584f6
d8113d698853c46b5aef2de7ea786c80
9338e8ceffa445b67258a19b9c9bce9e
a46bde2c727b9cd786020d6ba1114d2b
fadaf09355fa5d9dae4ca30515444d8a
253537184cf23cfa4f16af4b04514fce
fb8d3c4c262eefe2a49943839c8b5f1e
125a9b33b989d003db4fcf11c4809246
313f42ddb1a6cecf2be8d2652aa955e2
f90e14487c49ef58bc79696e25dcfbd7
From the same GHGist objects, here is the data that their GHGistFile objects contain:
Filename: Content
File.java: null
TestFile.cpp: null
TestFile.java: null
newGistFile.java: null
SerialzedObjectToBlob.java: null
TextFieldConstraints.java: null
Run.java: null
Button.css: null
StringPatterns2.java: null
RangeMap.java: null
themeDetector.java: null
ATestForAnother.java: null
ClassSerializationFileIO.java: null
Disk.java: null
FileChecksum.java: null
FileWalker.java: null
SampleNew.java: null
db.java: null
pom.xml: null
Begin.java: null
CSSBoxStyles.java: null
shadow-styles.css: null
ListOrganizer.java: null
OffScreenOffThreadCharts.java: null
package.sh: null
GOGOGadget.css: null
GitMeOuttaHere.java: null
SomethingDifferent.cpp: null
StringBuilder.java: null
C.java: null
Router.txt: null
SwitchA.text: null
SwitchB: null
SwitchC.txt: null
You can see that the File objects contain the name of the file, but not the content of the file.
Thank you,
Mike
@bitwiseman Hi Bitwiseman! May I request the access to hub4j-test-org as I managed to have a fix for this issue and want to submit my PR? I found this issue is caused by the file content field is not returned by the API and we need to do a lazy download from the raw_url field in case the file content is needed but has a null value.
@SCHJonathan Invitation sent.