mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
github: forbid creating gists from binary files
it is not supported by GitHub API
This commit is contained in:
@@ -118,6 +118,8 @@ public class GithubCreateGistAction extends DumbAwareAction {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
List<FileContent> contents = collectContents(project, editor, file, files);
|
||||
if (contents.isEmpty()) return;
|
||||
|
||||
String gistUrl =
|
||||
createGist(project, authHolder, indicator, contents, dialog.isPrivate(), dialog.getDescription(), dialog.getFileName());
|
||||
url.set(gistUrl);
|
||||
@@ -237,6 +239,10 @@ public class GithubCreateGistAction extends DumbAwareAction {
|
||||
if (file.isDirectory()) {
|
||||
return getContentFromDirectory(file, project, prefix);
|
||||
}
|
||||
if (file.getFileType().isBinary()) {
|
||||
GithubNotifications.showWarning(project, FAILED_TO_CREATE_GIST, "Can't upload binary file: " + file);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
String content = ReadAction.compute(() -> {
|
||||
try {
|
||||
Document document = FileDocumentManager.getInstance().getDocument(file);
|
||||
|
||||
Reference in New Issue
Block a user