MCPcopy Create free account
hub / github.com/experdot/pointer / buildStoredRelativePath

Function buildStoredRelativePath

src/main/attachmentStorage.ts:37–53  ·  view source on GitHub ↗
(
  fileId: string,
  fileName: string,
  pageId?: string,
  messageId?: string
)

Source from the content-addressed store, hash-verified

35}
36
37function buildStoredRelativePath(
38 fileId: string,
39 fileName: string,
40 pageId?: string,
41 messageId?: string
42): string {
43 const safeFileId = validatePathSegment(fileId, 'file ID')
44 const extension = path.extname(fileName)
45
46 if (pageId && messageId) {
47 const safePageId = validatePathSegment(pageId, 'page ID')
48 const safeMessageId = validatePathSegment(messageId, 'message ID')
49 return path.posix.join(safePageId, safeMessageId, `${safeFileId}${extension}`)
50 }
51
52 return path.posix.join('temp', `${safeFileId}${extension}`)
53}
54
55async function moveFile(sourcePath: string, targetPath: string): Promise<void> {
56 try {

Callers 2

saveAttachmentFileFunction · 0.85
moveAttachmentFileFunction · 0.85

Calls 1

validatePathSegmentFunction · 0.85

Tested by

no test coverage detected