mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-10-31 04:14:38 +08:00
fix(api): allow slashes in rule group names
This commit is contained in:
@@ -246,7 +246,7 @@ async def reorder_rule_groups(
|
||||
|
||||
|
||||
@router.put( # type: ignore[misc]
|
||||
"/groups/{name}",
|
||||
"/groups/{name:path}",
|
||||
summary="更新过滤规则组",
|
||||
response_model=_SchemaResponse[_SchemaJsonObject],
|
||||
)
|
||||
@@ -268,7 +268,7 @@ async def update_rule_group(
|
||||
|
||||
|
||||
@router.delete( # type: ignore[misc]
|
||||
"/groups/{name}",
|
||||
"/groups/{name:path}",
|
||||
summary="删除过滤规则组",
|
||||
response_model=_SchemaResponse[_SchemaJsonObject],
|
||||
)
|
||||
|
||||
@@ -107,6 +107,18 @@ def test_rule_query_and_mutation_endpoints_keep_separate_permissions():
|
||||
assert _dependency_of(endpoint, "_") is get_current_active_superuser_async
|
||||
|
||||
|
||||
def test_rule_group_mutation_routes_accept_slashes_in_group_names():
|
||||
"""规则组名称允许包含斜杠时,更新和删除路由必须接收完整名称。"""
|
||||
routes = {
|
||||
(route.endpoint, frozenset(route.methods)): route.path
|
||||
for route in rule_endpoint.router.routes
|
||||
if hasattr(route, "endpoint")
|
||||
}
|
||||
|
||||
assert routes[(rule_endpoint.update_rule_group, frozenset({"PUT"}))] == "/groups/{name:path}"
|
||||
assert routes[(rule_endpoint.delete_rule_group, frozenset({"DELETE"}))] == "/groups/{name:path}"
|
||||
|
||||
|
||||
def test_dashboard_endpoints_require_superuser():
|
||||
"""仪表板页面相关接口必须只允许管理员访问。"""
|
||||
assert _dependency_of(dashboard_endpoint.statistic, "_") is get_current_active_superuser
|
||||
|
||||
Reference in New Issue
Block a user