Skip to content

Commit bb3e4b1

Browse files
committed
Settings: Clean value from upload_extensions_replace_by setting
1 parent e757c63 commit bb3e4b1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

main/inc/lib/fileUpload.lib.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ function filter_extension(&$filename)
13421342
if ($skip == 'true') {
13431343
return 0;
13441344
} else {
1345-
$new_ext = api_get_setting('upload_extensions_replace_by');
1345+
$new_ext = getReplacedByExtension();
13461346
$filename = str_replace('.'.$ext, '.'.$new_ext, $filename);
13471347

13481348
return 1;
@@ -1362,7 +1362,7 @@ function filter_extension(&$filename)
13621362
if ($skip == 'true') {
13631363
return 0;
13641364
} else {
1365-
$new_ext = api_get_setting('upload_extensions_replace_by');
1365+
$new_ext = getReplacedByExtension();
13661366
$filename = str_replace('.'.$ext, '.'.$new_ext, $filename);
13671367

13681368
return 1;
@@ -1373,6 +1373,13 @@ function filter_extension(&$filename)
13731373
}
13741374
}
13751375

1376+
function getReplacedByExtension()
1377+
{
1378+
$extension = api_get_setting('upload_extensions_replace_by');
1379+
1380+
return 'REPLACED_'.api_replace_dangerous_char(str_replace('.', '', $extension));
1381+
}
1382+
13761383
/**
13771384
* Adds a new document to the database.
13781385
*

0 commit comments

Comments
 (0)