file-share-mcp 1.0.3 → 1.0.6

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/dist/gui.js CHANGED
@@ -30,19 +30,32 @@ app.get('/api/files', (req, res) => {
30
30
  res.status(500).json({ error: error.message });
31
31
  }
32
32
  });
33
- app.get('/api/download', (req, res) => {
33
+ app.get('/api/download', async (req, res) => {
34
+ const relativePath = req.query.path || '';
34
35
  try {
35
- const relativePath = req.query.path || '';
36
36
  const safePath = validateSafePath(relativePath);
37
+ console.log(`[download] path="${relativePath}" → safePath="${safePath}"`);
37
38
  if (fs.existsSync(safePath) && fs.statSync(safePath).isFile()) {
38
- res.download(safePath);
39
+ res.download(safePath, path.basename(safePath), (err) => {
40
+ if (err) {
41
+ console.error(`[download] Stream error for "${safePath}":`, err);
42
+ if (!res.headersSent) {
43
+ res.status(500).send(`Stream error: ${err.message}`);
44
+ }
45
+ }
46
+ else {
47
+ console.log(`[download] Completed: "${safePath}"`);
48
+ }
49
+ });
39
50
  }
40
51
  else {
41
- res.status(404).send('File not found');
52
+ console.warn(`[download] Not found or not a file: "${safePath}"`);
53
+ res.status(404).send(`File not found: ${relativePath}`);
42
54
  }
43
55
  }
44
56
  catch (error) {
45
- res.status(400).send(error.message);
57
+ console.error(`[download] Validation error for "${relativePath}":`, error);
58
+ res.status(400).send(`Invalid path: ${error.message}`);
46
59
  }
47
60
  });
48
61
  app.delete('/api/files', (req, res) => {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.0.3';
1
+ export const VERSION = '1.0.6';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "file-share-mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "MCP server for bidirectional file sharing between AI agents and users, with a built-in web GUI",
5
5
  "author": "",
6
6
  "license": "ISC",