Browse Source

fix: stabilize central feedback attachment names

yanqiliang 1 month ago
parent
commit
0f22449e2c

+ 3 - 1
00-框架治理_maintainers-only/06-中央飞书发送器/CentralFeedbackServer.ps1

@@ -114,7 +114,9 @@ try {
                 $fileHash = Get-Sha256Hex -Bytes $fileBytes
                 $submissionId = Get-Sha256Hex -Bytes ([Text.Encoding]::UTF8.GetBytes("$projectId|$recordVersion|$fileHash"))
                 # 旧版 Windows/.NET 对 multipart 文件名中的非 ASCII 字符存在兼容性问题;群内使用稳定 ASCII 名称,文件正文仍保留原始中文内容。
-                $displayFileName = ("$projectId-framework-feedback-$recordVersion.md" -replace '[^A-Za-z0-9._-]', '_')
+                $displayFileName = ('{0}-framework-feedback-{1}.md' -f $projectId, $recordVersion)
+                $displayFileName = $displayFileName -replace '[^A-Za-z0-9._-]', '_'
+                if ([string]::IsNullOrWhiteSpace($displayFileName)) { throw 'Generated display file name is empty.' }
                 if (Test-AlreadySent -SubmissionId $submissionId -Path $AuditPath) {
                     Write-HttpJson -Context $context -StatusCode 200 -Body @{ status = 'already_sent'; submission_id = $submissionId; file_hash = $fileHash }
                     continue