Browse Source

Not offering name of selected subfolder as a name of new file and not downloading the folder if it by coincidence matches with name of the new file

Source commit: b8c8dc8f50de19278412f542690094f1ef2401b2
Martin Prikryl 6 years ago
parent
commit
3e7a1692e8
1 changed files with 3 additions and 2 deletions
  1. 3 2
      source/forms/CustomScpExplorer.cpp

+ 3 - 2
source/forms/CustomScpExplorer.cpp

@@ -2953,7 +2953,7 @@ void __fastcall TCustomScpExplorerForm::EditNew(TOperationSide Side)
   TCustomDirView * DView = DirView(Side);
   TListItem * FocusedItem = DView->ItemFocused;
   UnicodeString Name;
-  if ((FocusedItem != NULL) && !DView->ItemIsParentDirectory(FocusedItem))
+  if ((FocusedItem != NULL) && !DView->ItemIsDirectory(FocusedItem))
   {
     Name = DView->ItemFileName(FocusedItem);
   }
@@ -2981,7 +2981,8 @@ void __fastcall TCustomScpExplorerForm::EditNew(TOperationSide Side)
         Name = AbsolutePath(FTerminal->CurrentDirectory, Name);
 
         TRemoteFile * File = NULL;
-        if (FTerminal->FileExists(Name, &File))
+        if (FTerminal->FileExists(Name, &File) &&
+            !File->IsDirectory)
         {
           try
           {