mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Raise error if server received windows path
This commit is contained in:
1 parent
58e7fa2f01
commit
5b347fe48f
2 files changed
+10
-2
No files matched your search
@@ -23,6 +23,7 @@ import asyncio
|
||||
import aiohttp
|
||||
import socket
|
||||
import shutil
|
||||
import re
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -401,7 +402,14 @@ class BaseManager:
|
||||
|
||||
if not path:
|
||||
return ""
|
||||
|
||||
img_directory = self.get_images_directory()
|
||||
|
||||
# Windows path should not be send to a unix server
|
||||
if not sys.platform.startswith("win"):
|
||||
if re.match(r"^[A-Z]:", path) is not None:
|
||||
raise VMError("{} is not allowed on this remote server. Please use only a filename in {}.".format(path, img_directory))
|
||||
|
||||
if not os.path.isabs(path):
|
||||
s = os.path.split(path)
|
||||
path = os.path.normpath(os.path.join(img_directory, *s))
|
||||
|
||||
Reference in new issue
Block a user