44 readTranscriptMediaEntries ,
55} from "../../lib/chat/message-extract.ts" ;
66import { buildChatItems } from "./chat-thread-build.ts" ;
7- import { extractTranscriptAttachments } from "./components/chat-message-media.ts" ;
7+ import { extractMessageAttachments } from "./components/chat-message-media.ts" ;
88
99const MANAGED_UUID = "43007e90-2ade-43f2-a781-42b843e9eca3" ;
1010
@@ -75,66 +75,71 @@ describe("chat history attachment card labels", () => {
7575 } ) ;
7676
7777 it ( "labels a managed inbound attachment with the persisted original fileName" , ( ) => {
78- const attachments = extractTranscriptAttachments (
78+ const attachments = extractMessageAttachments (
7979 userMessageWithMedia ( [
8080 {
8181 path : `media://inbound/report---${ MANAGED_UUID } .pdf` ,
8282 fileName : "report.pdf" ,
8383 contentType : "application/pdf" ,
8484 } ,
8585 ] ) ,
86+ [ ] ,
8687 ) ;
8788 expect ( attachments [ 0 ] ?. attachment . label ) . toBe ( "report.pdf" ) ;
8889 } ) ;
8990
9091 it ( "restores the original name from a legacy managed inbound UUID suffix when fileName is absent" , ( ) => {
91- const attachments = extractTranscriptAttachments (
92+ const attachments = extractMessageAttachments (
9293 userMessageWithMedia ( [
9394 {
9495 path : `media://inbound/openclaw-attachment-test---${ MANAGED_UUID } .docx` ,
9596 contentType : "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ,
9697 } ,
9798 ] ) ,
99+ [ ] ,
98100 ) ;
99101 expect ( attachments [ 0 ] ?. attachment . label ) . toBe ( "openclaw-attachment-test.docx" ) ;
100102 } ) ;
101103
102104 it ( "leaves non-managed https attachment paths unchanged" , ( ) => {
103105 // `---old` is not a canonical managed UUID suffix, so it must not be stripped
104106 // from https URLs (which never carry the collision-safe managed suffix).
105- const attachments = extractTranscriptAttachments (
107+ const attachments = extractMessageAttachments (
106108 userMessageWithMedia ( [
107109 {
108110 path : "https://example.com/files/openclaw-attachment-test---old.docx" ,
109111 contentType : "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ,
110112 } ,
111113 ] ) ,
114+ [ ] ,
112115 ) ;
113116 expect ( attachments [ 0 ] ?. attachment . label ) . toBe ( "openclaw-attachment-test---old.docx" ) ;
114117 } ) ;
115118
116119 it ( "does not strip a managed inbound basename that lacks a UUID suffix" , ( ) => {
117- const attachments = extractTranscriptAttachments (
120+ const attachments = extractMessageAttachments (
118121 userMessageWithMedia ( [
119122 {
120123 path : "media://inbound/plain-name.docx" ,
121124 contentType : "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ,
122125 } ,
123126 ] ) ,
127+ [ ] ,
124128 ) ;
125129 expect ( attachments [ 0 ] ?. attachment . label ) . toBe ( "plain-name.docx" ) ;
126130 } ) ;
127131
128132 it ( "strips only the terminal managed UUID suffix, preserving a UUID-shaped segment in the original name" , ( ) => {
129133 // Legacy record (no persisted fileName) whose original filename itself
130134 // contains a "---<uuid>"-shaped segment before the terminal managed suffix.
131- const attachments = extractTranscriptAttachments (
135+ const attachments = extractMessageAttachments (
132136 userMessageWithMedia ( [
133137 {
134138 path : `media://inbound/report---a1b2c3d4-e5f6-7890-abcd-ef1234567890-final---${ MANAGED_UUID } .docx` ,
135139 contentType : "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ,
136140 } ,
137141 ] ) ,
142+ [ ] ,
138143 ) ;
139144 expect ( attachments [ 0 ] ?. attachment . label ) . toBe (
140145 "report---a1b2c3d4-e5f6-7890-abcd-ef1234567890-final.docx" ,
@@ -143,8 +148,9 @@ describe("chat history attachment card labels", () => {
143148
144149 it ( "preserves a dotted UUID-shaped segment in a legacy attachment name" , ( ) => {
145150 const path = `media://inbound/report---a1b2c3d4-e5f6-7890-abcd-ef1234567890.backup---${ MANAGED_UUID } .pdf` ;
146- const attachments = extractTranscriptAttachments (
151+ const attachments = extractMessageAttachments (
147152 userMessageWithMedia ( [ { path, contentType : "application/pdf" } ] ) ,
153+ [ ] ,
148154 ) ;
149155
150156 expect ( attachments [ 0 ] ?. attachment ) . toMatchObject ( {
0 commit comments