提交 d46771b6 编写于 作者: R Rafael Mendonça França

Merge pull request #14770 from crazymykl/avoid_dos_vuln_in_i18n_guide

Avoid suggesting dangerous code in i18n guide
......@@ -179,7 +179,7 @@ end
# in your /etc/hosts file to try this out locally
def extract_locale_from_tld
parsed_locale = request.host.split('.').last
I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale : nil
end
```
......@@ -192,7 +192,7 @@ We can also set the locale from the _subdomain_ in a very similar way:
# in your /etc/hosts file to try this out locally
def extract_locale_from_subdomain
parsed_locale = request.subdomains.first
I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale : nil
I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale : nil
end
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册