mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Change Path return PosixPath to purepath
This commit is contained in:
parent
95e21d9245
commit
ac1b94d35b
@ -2,7 +2,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import PurePath
|
||||||
import tornado.web
|
import tornado.web
|
||||||
import tornado.escape
|
import tornado.escape
|
||||||
import bleach
|
import bleach
|
||||||
@ -320,7 +320,9 @@ class ServerHandler(BaseHandler):
|
|||||||
return
|
return
|
||||||
import_type = bleach.clean(self.get_argument("create_type", ""))
|
import_type = bleach.clean(self.get_argument("create_type", ""))
|
||||||
import_server_path = bleach.clean(self.get_argument("server_path", ""))
|
import_server_path = bleach.clean(self.get_argument("server_path", ""))
|
||||||
if Path(self.controller.project_root).is_relative_to(import_server_path):
|
if PurePath(self.controller.project_root).is_relative_to(
|
||||||
|
import_server_path
|
||||||
|
):
|
||||||
self.redirect(
|
self.redirect(
|
||||||
"/panel/error?error=Loop Error: The selected path will cause"
|
"/panel/error?error=Loop Error: The selected path will cause"
|
||||||
" an infinite copy loop. Make sure Crafty's directory is not"
|
" an infinite copy loop. Make sure Crafty's directory is not"
|
||||||
@ -476,7 +478,9 @@ class ServerHandler(BaseHandler):
|
|||||||
return
|
return
|
||||||
import_type = bleach.clean(self.get_argument("create_type", ""))
|
import_type = bleach.clean(self.get_argument("create_type", ""))
|
||||||
import_server_path = bleach.clean(self.get_argument("server_path", ""))
|
import_server_path = bleach.clean(self.get_argument("server_path", ""))
|
||||||
if Path(self.controller.project_root).is_relative_to(import_server_path):
|
if PurePath(self.controller.project_root).is_relative_to(
|
||||||
|
import_server_path
|
||||||
|
):
|
||||||
self.redirect(
|
self.redirect(
|
||||||
"/panel/error?error=Loop Error: The selected path will cause"
|
"/panel/error?error=Loop Error: The selected path will cause"
|
||||||
" an infinite copy loop. Make sure Crafty's directory is not"
|
" an infinite copy loop. Make sure Crafty's directory is not"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user