摆脱插件路由增强器中的乱码
get rid of chash in route enhancer for plugin
如何去掉 pi_based 扩展中的 cHash 参数?手册说:
"The requirements section exactly specifies what kind of parameter should be added to that route as regular expression. This way, it is configurable to only allow integer values for e.g. pagination. If the requirements are too loose, a URL signature parameter ("cHash") 添加到 URL 的末尾,无法删除。"
但是严格到什么程度呢?我的配置:
Lexikon:
type: Plugin
limitToPages: [2140]
routePath: '/eintrag/{eintrag}/{buchstabe}'
namespace: 'tx_mcflexikon_pi1'
requirements:
buchstabe: '[A-Z]{1}'
eintrag: '[0-9]{1,4}'
default:
buchstabe: 'A'
eintrag: '0'
除了这些之外,我不知道如何定义更严格的规则:1 个字母和 1 到 4 个数字。
谢谢!
好吧,几个小时后我找到了解决方法。似乎部分要求中的定义对于 cHash-Handling 并不是很重要。更重要的是方面部分。如果我为每个参数定义一个方面,cHash 消失:
Lexikon:
type: Plugin
limitToPages: [2140]
routePath: '/eintrag/{buchstabe}/{eintrag}'
namespace: 'tx_mcflexikon_pi1'
requirements:
buchstabe: '[A-Z]{1}'
eintrag: '[0-9]{1,4}'
default:
buchstabe: 'A'
eintrag: '0'
aspects:
eintrag:
type: PersistedAliasMapper
tableName: 'tx_mcflexikon_daten'
routeFieldName: 'slug'
buchstabe:
type: StaticValueMapper
map:
A: 'A'
B: 'B'
C: 'C'
D: 'D'
E: 'E'
G: 'G'
H: 'H'
I: 'I'
J: 'J'
K: 'K'
L: 'L'
M: 'M'
N: 'N'
O: 'O'
P: 'P'
Q: 'Q'
R: 'R'
S: 'S'
T: 'T'
U: 'U'
V: 'V'
W: 'W'
X: 'X'
Y: 'Y'
Z: 'Z'
定义每个字母有点烦人,但我没有找到其他可能性; StaticRangeMapper 和 PersistedAliasMapper 在此上下文中不起作用。
也许可以定义一个不执行任何操作的自定义映射器来欺骗系统。另一方面:这显然会导致安全问题。
如何去掉 pi_based 扩展中的 cHash 参数?手册说:
"The requirements section exactly specifies what kind of parameter should be added to that route as regular expression. This way, it is configurable to only allow integer values for e.g. pagination. If the requirements are too loose, a URL signature parameter ("cHash") 添加到 URL 的末尾,无法删除。"
但是严格到什么程度呢?我的配置:
Lexikon:
type: Plugin
limitToPages: [2140]
routePath: '/eintrag/{eintrag}/{buchstabe}'
namespace: 'tx_mcflexikon_pi1'
requirements:
buchstabe: '[A-Z]{1}'
eintrag: '[0-9]{1,4}'
default:
buchstabe: 'A'
eintrag: '0'
除了这些之外,我不知道如何定义更严格的规则:1 个字母和 1 到 4 个数字。
谢谢!
好吧,几个小时后我找到了解决方法。似乎部分要求中的定义对于 cHash-Handling 并不是很重要。更重要的是方面部分。如果我为每个参数定义一个方面,cHash 消失:
Lexikon:
type: Plugin
limitToPages: [2140]
routePath: '/eintrag/{buchstabe}/{eintrag}'
namespace: 'tx_mcflexikon_pi1'
requirements:
buchstabe: '[A-Z]{1}'
eintrag: '[0-9]{1,4}'
default:
buchstabe: 'A'
eintrag: '0'
aspects:
eintrag:
type: PersistedAliasMapper
tableName: 'tx_mcflexikon_daten'
routeFieldName: 'slug'
buchstabe:
type: StaticValueMapper
map:
A: 'A'
B: 'B'
C: 'C'
D: 'D'
E: 'E'
G: 'G'
H: 'H'
I: 'I'
J: 'J'
K: 'K'
L: 'L'
M: 'M'
N: 'N'
O: 'O'
P: 'P'
Q: 'Q'
R: 'R'
S: 'S'
T: 'T'
U: 'U'
V: 'V'
W: 'W'
X: 'X'
Y: 'Y'
Z: 'Z'
定义每个字母有点烦人,但我没有找到其他可能性; StaticRangeMapper 和 PersistedAliasMapper 在此上下文中不起作用。
也许可以定义一个不执行任何操作的自定义映射器来欺骗系统。另一方面:这显然会导致安全问题。