mrmd-server 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/file.js +8 -3
package/package.json
CHANGED
package/src/api/file.js
CHANGED
|
@@ -22,9 +22,10 @@ export function createFileRoutes(ctx) {
|
|
|
22
22
|
*/
|
|
23
23
|
router.get('/scan', async (req, res) => {
|
|
24
24
|
try {
|
|
25
|
-
// Default to
|
|
25
|
+
// Default to project dir, then cwd, then home
|
|
26
|
+
// On servers like RunPod, cwd (/workspace) is more useful than home (/root)
|
|
26
27
|
const os = await import('os');
|
|
27
|
-
const root = req.query.root || ctx.projectDir || os.default.homedir();
|
|
28
|
+
const root = req.query.root || ctx.projectDir || process.cwd() || os.default.homedir();
|
|
28
29
|
const options = {
|
|
29
30
|
// Default to both .md and .ipynb (like Electron)
|
|
30
31
|
extensions: req.query.extensions?.split(',') || ['.md', '.ipynb'],
|
|
@@ -32,7 +33,11 @@ export function createFileRoutes(ctx) {
|
|
|
32
33
|
includeHidden: req.query.includeHidden === 'true',
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
console.log(`[file:scan] Scanning ${root} with options:`, options);
|
|
37
|
+
const relativeFiles = await fileService.scan(root, options);
|
|
38
|
+
// Convert relative paths to absolute (file picker expects absolute paths)
|
|
39
|
+
const files = relativeFiles.map(f => path.join(root, f));
|
|
40
|
+
console.log(`[file:scan] Found ${files.length} files`);
|
|
36
41
|
res.json(files);
|
|
37
42
|
} catch (err) {
|
|
38
43
|
console.error('[file:scan]', err);
|