cacheMetaScope method

  1. @override
List<String>? cacheMetaScope(
  1. String location
)
override

github/<owner>/<repo>: tree listings and the default branch are kept per repository, so a location naming a folder answers its repository. Parsed leniently, because a location may name the repository root (github:owner/repo), which is no document locator.

Implementation

@override
List<String>? cacheMetaScope(String location) {
  if (!handles(location)) return null;
  final segments = location
      .substring(TomGitHubLocator.scheme.length)
      .split('/');
  if (segments.length < 2 || segments[0].isEmpty) return null;
  final repo = segments[1].split('@').first;
  if (repo.isEmpty) return null;
  return [_metaRoot, segments[0], repo];
}