Skip to content

Commit b252804

Browse files
committed
allow keeping spaces in filename
1 parent a61510d commit b252804

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/services/formatting.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class formatting {
1212
*
1313
* @return string
1414
*/
15-
public static function fileName( string $fileName, string $replacementForIllegalChars = '-', bool $forceLowerCase = true ) : string {
15+
public static function fileName( string $fileName, string $replacementForIllegalChars = '-', bool $forceLowerCase = true, bool $replaceSpace = true ) : string {
1616
$illegalChars = [
1717
'\\',
1818
'/',
@@ -24,8 +24,10 @@ public static function fileName( string $fileName, string $replacementForIllegal
2424
'>',
2525
'|',
2626
',',
27-
' '
2827
];
28+
if($replaceSpace) {
29+
$illegalChars[] = ' ';
30+
}
2931

3032
$correction = $forceLowerCase ? strtolower( $fileName ) : $fileName;
3133
$correction = str_replace( $illegalChars, $replacementForIllegalChars, $correction );

0 commit comments

Comments
 (0)