Repository: iterative/dvc
Issue: dvc get can can delete the current directory

First off, I saw it coming, had my stuff backed up etc, so no harm done. 
I was trying to test out dvc get to pull models from a different project and the cache must not have been present in the remote:

`models/mlr/production` is defined as the output of a dvc file. 

```
$ dvc get <internal_repo> models/mlr/production/ --rev <name of branch>
WARNING: Some of the cache files do not exist neither locally nor on remote. Missing cache files:    
name: models/mlr/production, md5: ebbb5c351028a6e5485dfdec639fbb57.dir
Missing cache for directory '../../../tmp/tmp5jtl3fccdvc-erepo/models/mlr/production'. Cache for files inside will be lost. Would you like to continue? Use '-f' to force. [y/n] y            
WARNING: Some of the cache files do not exist neither locally nor on remote. Missing cache files:   
name: models/mlr/production, md5: ebbb5c351028a6e5485dfdec639fbb57.dir
WARNING: Cache 'ebbb5c351028a6e5485dfdec639fbb57.dir' not found. File '.' won't be created.                                                                                                   
file '.' is going to be removed. Are you sure you want to proceed? [y/n] y                                                                                                                    
ERROR: unexpected error - [Errno 2] No such file or directory
```

Once I saw the `File '.' won't be created.  file '.' is going to be removed. ` I knew what was going to happen, but was surprised that dvc lets you do that. (It wiped out my whole git repo ;)) 

DVC version 0.80.0,
Platform WSL
method of installation: pip





Changed files:
tests/unit/utils/test_utils.py, dvc/utils/__init__.py

diff --git a/dvc/utils/__init__.py b/dvc/utils/__init__.py
index edb77e93b..bf02ecdb2 100644
--- a/dvc/utils/__init__.py
+++ b/dvc/utils/__init__.py
@@ -336,7 +336,7 @@ def env2bool(var, undefined=False):
 def resolve_output(inp, out):
     from urllib.parse import urlparse
 
-    name = os.path.basename(urlparse(inp).path)
+    name = os.path.basename(os.path.normpath(urlparse(inp).path))
     if not out:
         return name
     if os.path.isdir(out):
diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py
index e53c8df21..62f31446b 100644
--- a/tests/unit/utils/test_utils.py
+++ b/tests/unit/utils/test_utils.py
@@ -4,7 +4,7 @@ import os
 import pytest
 
 from dvc.path_info import PathInfo
-from dvc.utils import file_md5
+from dvc.utils import file_md5, resolve_output
 from dvc.utils import fix_env
 from dvc.utils import relpath
 from dvc.utils import to_chunks
@@ -104,3 +104,28 @@ def test_relpath():
     path_info = PathInfo(path)
 
     assert relpath(path) == relpath(path_info)
+
+
+@pytest.mark.parametrize(
+    "inp,out,is_dir,expected",
+    [
+        ["target", None, False, "target"],
+        ["target", "dir", True, os.path.join("dir", "target")],
+        ["target", "file_target", False, "file_target"],
+        [
+            "target",
+            os.path.join("dir", "subdir"),
+            True,
+            os.path.join("dir", "subdir", "target"),
+        ],
+        ["dir/", None, False, "dir"],
+        ["dir", None, False, "dir"],
+        ["dir", "other_dir", False, "other_dir"],
+        ["dir", "other_dir", True, os.path.join("other_dir", "dir")],
+    ],
+)
+def test_resolve_output(inp, out, is_dir, expected, mocker):
+    with mocker.patch("os.path.isdir", return_value=is_dir):
+        result = resolve_output(inp, out)
+
+    assert result == expected