Get artifact responses, extract paths and send corresponding files.

def _ProcessArtifactFilesSource(self, source):
    """Get artifact responses, extract paths and send corresponding files."""

    if source.path_type != rdf_paths.PathSpec.PathType.OS:
      raise ValueError("Only supported path type is OS.")

    # TODO(user): Check paths for GlobExpressions.
    # If it contains a * then FileFinder will interpret it as GlobExpression and
    # expand it. FileFinderArgs needs an option to treat paths literally.

    paths = []
    pathspec_attribute = source.base_source.attributes.get("pathspec_attribute")

    for source_result_list in self._ProcessSources(
        source.artifact_sources, parser_factory=None):
      for response in source_result_list:
        path = _ExtractPath(response, pathspec_attribute)
        if path is not None:
          paths.append(path)

    file_finder_action = rdf_file_finder.FileFinderAction.Download()
    request = rdf_file_finder.FileFinderArgs(
        paths=paths, pathtype=source.path_type, action=file_finder_action)
    action = file_finder.FileFinderOSFromClient

    yield action, request