Skip to content

Commit

Permalink
Merge pull request #190 from Dreimus/develop
Browse files Browse the repository at this point in the history
Some fixes on uploads
  • Loading branch information
PrestaSafe authored Jan 25, 2024
2 parents 474bd01 + 28d665b commit 1771597
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion classes/HelperBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ public static function pathFormattedFromString($path, $rtrim = false)
if (strpos($path, '..') !== false) {
throw new Exception('Invalid path');
}
if (substr($path, 0, 1) !== '$') {
if ($path[0] !== '$') {
throw new Exception('Path "' . $path . '" should begin by $ ex: "$/prettyblocks/path/to/images/"');
}
$pathFormatted = str_replace('$', _PS_ROOT_DIR_, $path);

if (substr($pathFormatted, -1) === '/') {
$pathFormatted = substr($pathFormatted, 0, -1);
}
$path = realpath($pathFormatted) . '/';
if ($rtrim) {
$path = rtrim($path, '/');
Expand Down

0 comments on commit 1771597

Please sign in to comment.