SilverStripe 3.1+更改FileNameFilter默认替换 [英] SilverStripe 3.1+ change FileNameFilter default replacements
问题描述
与此问题相同: https://github.com/silverstripe/silverstripe -cms / issues / 719
我发现这是通过FileNameFilter发生的 http://api.silverstripe.org/master/class-FileNameFilter.html#_setReplacements
FileNameFilter:$ b $我试过按照说明来停止这个操作b default_use_transliterator:false
default_replacements:
这不起作用吗?
也改变这一行:
$ $ $ $ $ $ $ $ $ $' /'=> ' - ',//下划线
至此
'/ _ /'=> '_',//强调破折号
但是这只是消除了它们并缩小了差距。 / p>
有人建议用正确的方法来达到这个目的吗?
我意识到你也可以在你的_config.php文件中做到这一点!而这一直奏效。我会离开这个问题,这对像我这样的人是有用的。
$ _config.php
FileNameFilter :: $ default_use_transliterator = false;
FileNameFilter :: $ default_replacements = array();
Currently uploading a file with an '_' (underscore) in it is automatically replace with '-' (hyphen). I need them to stay as _ . The same as this issue: https://github.com/silverstripe/silverstripe-cms/issues/719
I've discovered this happens via FileNameFilter http://api.silverstripe.org/master/class-FileNameFilter.html#_setReplacements
I've tried to follow the instructions to stop this by adding this to the YAML config:
FileNameFilter:
default_use_transliterator: false
default_replacements:
This has no effect do I need to state the new defaults?
And also changing this line:
'/_/' => '-', // underscores to dashes
to this
'/_/' => '_', // underscores to dashes
But this just removes them and closes the gap..
Could someone advise on the correct way to achieve this?
I realised you can do this in your _config.php file too! And this has worked. I'll leave this question up incase this is useful for anyone like me.
_config.php
FileNameFilter::$default_use_transliterator = false;
FileNameFilter::$default_replacements = array();
这篇关于SilverStripe 3.1+更改FileNameFilter默认替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!