class GithubScmContentProvider extends AbstractScmContentProvider {

    @Override
    protected Object getContent(ScmGetRequest request) {
        GithubScm.validateUserHasPushPermission(request.getApiUrl(), request.getCredentials().getPassword().getPlainText(), request.getOwner(), request.getRepo());

        String url = String.format("%s/repos/%s/%s/contents/%s",
                request.getApiUrl(),
                request.getOwner(),
                request.getRepo(),
                request.getPath());
        if(request.getBranch() != null){ //if branch is present fetch this file from branch
            url += "?ref="+request.getBranch();
        }
        try {
            Map ghContent = HttpRequest.get(url)
                    .withAuthorizationToken(request.getCredentials().getPassword().getPlainText())
                    .to(Map.class);

            if(ghContent == null){
                throw new ServiceException.UnexpectedErrorException("Failed to load file: "+request.getPath());
            }

            String base64Data = (String)ghContent.get("content");
            // JENKINS-47887 - this content contains \n which breaks IE11
            base64Data = base64Data == null ? null : base64Data.replace("\n", "");
            return new GithubFile(new GitContent.Builder()
                    .sha((String)ghContent.get("sha"))
                    .name((String)ghContent.get("name"))
                    .repo(request.getRepo())
                    .owner(request.getOwner())
                    .path(request.getPath())
                    .base64Data(base64Data)
                    .build());
        } catch (IOException e) {
            throw new ServiceException.UnexpectedErrorException(String.format("Failed to load file %s: %s", request.getPath(),e.getMessage()), e);
        }
    }

}