@NotNull
  private static List<FileContent> getContentFromFile(@NotNull final VirtualFile file, @NotNull Project project, @Nullable String prefix) {
    final VirtualFile realFile = BackedVirtualFile.getOriginFileIfBacked(file);
    if (realFile.isDirectory()) {
      return getContentFromDirectory(realFile, project, prefix);
    }
    if (realFile.getFileType().isBinary()) {
      GithubNotifications
        .showWarning(project, GithubNotificationIdsHolder.GIST_CANNOT_CREATE,
                     GithubBundle.message("cannot.create.gist"),
                     GithubBundle.message("create.gist.error.binary.file", realFile.getName()));
      return Collections.emptyList();
    }
    String content = WriteAction.computeAndWait(() -> {
      try {
        FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
        Document document = fileDocumentManager.getDocument(realFile);
        if (document != null) {
          fileDocumentManager.saveDocument(document);
          return document.getText();
        }
        else {
          return new String(realFile.contentsToByteArray(), realFile.getCharset());
        }
      }
      catch (IOException e) {
        LOG.info("Couldn't read contents of the file " + realFile, e);
        return null;
      }
    });
    if (content == null) {
      GithubNotifications
        .showWarning(project,
                     GithubNotificationIdsHolder.GIST_CANNOT_CREATE,
                     GithubBundle.message("cannot.create.gist"),
                     GithubBundle.message("create.gist.error.content.read", realFile.getName()));
      return Collections.emptyList();
    }
    if (StringUtil.isEmptyOrSpaces(content)) {
      return Collections.emptyList();
    }
    String filename = addPrefix(realFile.getName(), prefix, false);
    return Collections.singletonList(new FileContent(filename, content));
  }
@NotNull
  private static List<FileContent> getContentFromFile(@NotNull final VirtualFile file, @NotNull Project project, @Nullable String prefix)