Skip to content

Commit

Permalink
disallow special characters for asset filenames, see also #2971
Browse files Browse the repository at this point in the history
  • Loading branch information
brusch committed Jul 18, 2018
1 parent fa07461 commit 270ad50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -3,6 +3,9 @@

## Version 5.3.0

#### Build 285 (2018-07-18)
Asset filenames: introduced new policy, the following disallowed characters were added: `#?*:\<>|"`

#### Build 281 (2018-07-13)
The admin UI translations are not split into 2 parts,
[Essentials](https://poeditor.com/join/project/VWmZyvFVMH) and [Extended](https://poeditor.com/join/project/XliCYYgILb).
Expand Down
3 changes: 3 additions & 0 deletions pimcore/models/Element/Service.php
Expand Up @@ -888,6 +888,9 @@ public static function getValidKey($key, $type)
// keys shouldn't start with a "." (=hidden file) *nix operating systems
// keys shouldn't end with a "." - Windows issue: filesystem API trims automatically . at the end of a folder name (no warning ... et al)
$key = trim($key, '. ');

// windows forbidden filenames + URL reserved characters (at least the once which are problematic)
$key = preg_replace('/[#\?\*\:\\\\<\>\|"]/', '-', $key);
} else {
$key = trim($key);
$key = ltrim($key, '.');
Expand Down

0 comments on commit 270ad50

Please sign in to comment.