docs: refresh translations for recent English changes (#3379)
This commit is contained in:
parent
d8b638304e
commit
c5d7d0b6d0
1 changed files with 3149 additions and 1047 deletions
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
translation:
|
||||
sections: [4a7033e1ed8ad602, 55dcbfff0c6271bf, 101ef9d14bf4ec46, 4b6c4a845438abc7, f98b46bafbee4acd]
|
||||
sections: [4a7033e1ed8ad602, 55dcbfff0c6271bf, 317f4256a650cab6, 4b6c4a845438abc7, f98b46bafbee4acd]
|
||||
tool: 1
|
||||
---
|
||||
# URI 模板与路径安全 {#uri-templates-and-path-safety}
|
||||
|
|
@ -98,7 +98,7 @@ translation:
|
|||
|
||||
内置检查能拦住常见情况,但无从知道你的沙箱边界在哪。访问文件系统时,用 `safe_join` 解析路径并确认它仍在基础目录之内:
|
||||
|
||||
```python title="server.py" hl_lines="4 14"
|
||||
```python title="server.py" hl_lines="5 15"
|
||||
--8<-- "docs_src/uri_templates/tutorial002.py"
|
||||
```
|
||||
|
||||
|
|
@ -124,10 +124,10 @@ translation:
|
|||
| `reject_null_bytes` | `True` | 拒绝包含 `\x00` 的值 |
|
||||
| `exempt_params` | 空 | 要跳过检查的参数名 |
|
||||
|
||||
这些检查只是启发式的预过滤;访问文件系统时,`safe_join` 仍然是真正的隔离边界。
|
||||
这些检查只是启发式的预过滤;访问文件系统时,`safe_join` 仍然是隔离边界。
|
||||
|
||||
!!! tip
|
||||
如果处理函数无法完成请求(文件不存在、id 未知),就抛出异常。SDK 会把它变成错误响应。协议错误和工具错误的区别见 **[处理错误](handling-errors.md)**。
|
||||
如果处理函数无法完成请求(文件不存在、id 未知),就像上面的 `read_manual` 那样抛出 `ResourceNotFoundError`。客户端会收到 `-32602`,附带你的消息和 URI。意料之外的异常则会变成通用的 `-32603`。见 **[处理错误](handling-errors.md#a-resource-that-doesnt-exist)**。
|
||||
|
||||
## 底层 Server 上的资源 {#resources-on-the-low-level-server}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue