From 28a26dc01f9c18f99ef932ad2d7bccc411659b49 Mon Sep 17 00:00:00 2001 From: ymq Date: Wed, 16 Sep 2026 14:57:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(todos):=20=E6=A0=87=E4=B9=A6md=E4=B8=8Edocx?= =?UTF-8?q?=E5=90=8C=E5=90=8D=E4=BA=A7=E7=89=A9=E9=83=BD=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E2=80=94=E2=80=94=E4=BA=A4=E4=BB=98=E7=A1=AE=E8=AE=A4=E5=BE=85?= =?UTF-8?q?=E5=8A=9E=E6=8C=89basename=E6=B4=BE=E7=94=9F.md/.docx=E4=B8=A4?= =?UTF-8?q?=E5=80=99=E9=80=89,=E5=AE=9E=E9=99=85=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=9A=84=E6=89=8D=E5=87=BA=E8=A1=8C(md=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B+docx=E4=B8=8B=E8=BD=BD);=E5=8E=9F=E5=8D=95?= =?UTF-8?q?=E5=90=91md=E2=86=92docx=E8=A1=A5=E5=85=A8=E5=9C=A8file=5Fpath?= =?UTF-8?q?=E5=B7=B2=E6=8C=87=E5=90=91docx=E6=97=B6=E6=BC=8F=E6=8E=89md?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/todo_detail.dspy | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wwwroot/api/todo_detail.dspy b/wwwroot/api/todo_detail.dspy index 948ebc7..ec218d9 100644 --- a/wwwroot/api/todo_detail.dspy +++ b/wwwroot/api/todo_detail.dspy @@ -546,11 +546,15 @@ async with DBPools().sqlorContext(dbname) as sor: md.append('') _bf = _s(getattr(b0, 'file_path', '')) if _bf: - _file_rows.append(_file_link_row(os.path.basename(_bf), project_id, _bf)) - # 2026-09-16:md 有 docx 同名产物时一并给出(标书最终交付 docx) - _bf_docx = os.path.splitext(_bf)[0] + '.docx' - if _bf_docx != _bf: - _file_rows.append(_file_link_row(os.path.basename(_bf_docx), project_id, _bf_docx)) + # 2026-09-16:标书 md(可在线查看)与 docx(最终交付)同名产物 + # 都给出——file_path 可能指向其中任一,按 basename 派生两个候选, + # 实际存在的才出行(md 走在线查看、docx 走下载)。 + _base, _ext = os.path.splitext(_bf) + for _cand in (_base + '.md', _base + '.docx'): + if _cand and os.path.isfile(_cand): + _file_rows.append(_file_link_row(os.path.basename(_cand), project_id, _cand)) + if not any(os.path.isfile(c) for c in (_base + '.md', _base + '.docx')): + _file_rows.append(_file_link_row(os.path.basename(_bf), project_id, _bf)) else: md.append('## 待确认标书') md.append('')