MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / apiUrl

Function apiUrl

apps/webuiapps/src/lib/diskStorage.ts:13–29  ·  view source on GitHub ↗

Build the full API URL for a file path, scoped under current session's /apps/ directory

(filePath: string, action?: string)

Source from the content-addressed store, hash-verified

11
12/** Build the full API URL for a file path, scoped under current session's /apps/ directory */
13function apiUrl(filePath: string, action?: string): string {
14 const session = getSessionPath();
15 // Strip leading slash for uniform handling
16 const cleaned = filePath.startsWith('/') ? filePath.slice(1) : filePath;
17 // If the path already starts with "apps/", don't add the prefix again
18 const alreadyPrefixed = cleaned.startsWith('apps/') || cleaned === 'apps';
19 const fullPath = session
20 ? alreadyPrefixed
21 ? `${session}/${cleaned}`
22 : `${session}/apps/${cleaned}`
23 : alreadyPrefixed
24 ? cleaned
25 : `apps/${cleaned}`;
26 let url = `${API_PATH}?path=${encodeURIComponent(fullPath)}`;
27 if (action) url += `&action=${encodeURIComponent(action)}`;
28 return url;
29}
30
31/**
32 * List files in a directory.

Callers 5

listFilesFunction · 0.70
getFileFunction · 0.70
putTextFilesByJSONFunction · 0.70
putBinaryFileFunction · 0.70
deleteFilesByPathsFunction · 0.70

Calls 1

getSessionPathFunction · 0.90

Tested by

no test coverage detected