Skip to content

Commit 6fc582c

Browse files
author
tolanych
committed
fix impossibility remove file with two dots
1 parent af48a7c commit 6fc582c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: core/model/modx/processors/browser/file/create.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function process() {
3333
$directory = ltrim(strip_tags(preg_replace('/[\.]{2,}/', '', htmlspecialchars($directory))),'/');
3434

3535
$name = $this->getProperty('name');
36-
$name = ltrim(strip_tags(preg_replace('/[\.]{2,}/', '', htmlspecialchars($name))),'/');
36+
$name = ltrim(strip_tags(htmlspecialchars($name)),'/');
3737

3838
$loaded = $this->getSource();
3939
if (!($this->source instanceof modMediaSource)) {

Diff for: core/model/modx/processors/browser/file/remove.class.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public function process() {
3333
if (empty($file)) {
3434
return $this->modx->error->failure($this->modx->lexicon('file_err_ns'));
3535
}
36-
$file = preg_replace('/[\.]{2,}/', '', $file);
36+
$directory = preg_replace('/[\.]{2,}/', '', htmlspecialchars(pathinfo($file, PATHINFO_DIRNAME)));
37+
$name = htmlspecialchars(pathinfo($file, PATHINFO_BASENAME));
38+
$path = $directory.$name;
3739

3840
$loaded = $this->getSource();
3941
if (!($this->source instanceof modMediaSource)) {

0 commit comments

Comments
 (0)