A partial patch can overwrite concurrent edits or replace every matching location
Source references: 3This is not an atomic patch: it downloads the full file, runs `ReplaceAll` or a whole-document regex replacement, then uploads a complete overwrite. There is no stated concurrency guard, and the result reports only a match count rather than locations.
Content submitted by someone else during that interval may be silently lost. An overly broad literal or regex pattern can also alter multiple unintended parts of the document.
The documentation confirms that patch applies replacement across the entire Markdown and is implemented as download, local replacement, then whole-file overwrite. If someone edits the file after download, the upload may overwrite that edit; an overly broad literal or regex pattern can also replace every match. Only a match count is returned, not locations. Users can require `--dry-run`, narrowly scoped patterns, and no concurrent editing of collaborative files.
- `--content` 必须显式传入,但允许为空字符串- 未加 `--regex` 时,行为等价于对整份 Markdown 文本执行 `strings.ReplaceAll`- 加了 `--regex` 时,行为等价于对整份 Markdown 文本执行 RE2 全量替换;`--content` 里的 `$1`、`${name}` 会按 Go regexp replacement template 解释,字面 `$` 请写成 `$$`- 替换后的最终 Markdown 不能为空;如果 patch 结果是空字符串,CLI 会直接报错,不会上传空文件,因为 Drive 不支持零字节 Markdown,且空文件通常是误操作- `0` 命中时命令仍然成功返回,但不会上传新版本Show 2 other places
- 该命令的内部语义是:**download -> local replace -> overwrite upload**- 它不是服务端原子 patch;如果有人在你下载后、上传前更新了同一文件,本次 patch 仍可能覆盖那次中间修改- 它不会返回详细匹配位置,只返回命中数量- `--dry-run` 会同时展示两种可能的上传路径:`upload_all`(小文件)和 `upload_prepare/upload_part/upload_finish`(大文件分片上传)# 预览底层编排lark-cli markdown +patch \ --file-token boxcnxxxx \ --pattern 'hello markdown' \ --content 'hello patched' \ --dry-run```