File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -100,15 +100,16 @@ def file_is_editable(filepath):
100
100
'''
101
101
allowed_paths = (
102
102
# Media item thumbnails
103
- os .path .commonpath ([os .path .abspath (str (settings .MEDIA_ROOT ))]),
103
+ Path (str (settings .MEDIA_ROOT )).resolve (),
104
+
104
105
# Downloaded media files
105
- os . path . commonpath ([ os . path . abspath ( str (settings .DOWNLOAD_ROOT ))] ),
106
+ Path ( str (settings .DOWNLOAD_ROOT )). resolve ( ),
106
107
)
107
- filepath = os . path . abspath (str (filepath ))
108
- if not os . path . isfile ( filepath ):
108
+ filepath = Path (str (filepath )). resolve ( )
109
+ if not filepath . is_file ( ):
109
110
return False
110
111
for allowed_path in allowed_paths :
111
- if allowed_path == os .path .commonpath ([allowed_path , filepath ]):
112
+ if str ( allowed_path ) == os .path .commonpath ([allowed_path , filepath ]):
112
113
return True
113
114
return False
114
115
You can’t perform that action at this time.
0 commit comments