NIFI-13485 Use readBlob when reading content in GitHubRepositoryClient

- The readBlob method avoids issues with 1 MB limits on alternative getContent requests

This closes #9067

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Bryan Bende 2024-07-10 14:05:37 -04:00 committed by exceptionfactory
parent 3b2120e6c6
commit cbdabccd6b
No known key found for this signature in database

View File

@ -212,7 +212,7 @@ public class GitHubRepositoryClient {
return execute(() -> { return execute(() -> {
try { try {
final GHContent ghContent = repository.getFileContent(resolvedPath, branchRef); final GHContent ghContent = repository.getFileContent(resolvedPath, branchRef);
return ghContent.read(); return repository.readBlob(ghContent.getSha());
} catch (final FileNotFoundException fnf) { } catch (final FileNotFoundException fnf) {
throwPathOrBranchNotFound(fnf, resolvedPath, branchRef); throwPathOrBranchNotFound(fnf, resolvedPath, branchRef);
return null; return null;
@ -238,7 +238,7 @@ public class GitHubRepositoryClient {
return execute(() -> { return execute(() -> {
try { try {
final GHContent ghContent = repository.getFileContent(resolvedPath, commitSha); final GHContent ghContent = repository.getFileContent(resolvedPath, commitSha);
return ghContent.read(); return repository.readBlob(ghContent.getSha());
} catch (final FileNotFoundException fnf) { } catch (final FileNotFoundException fnf) {
throw new FlowRegistryException("Path [" + resolvedPath + "] or Commit [" + commitSha + "] not found", fnf); throw new FlowRegistryException("Path [" + resolvedPath + "] or Commit [" + commitSha + "] not found", fnf);
} }