Skip to content

Commit 1807ae0

Browse files
author
masdeft
committed
Fix a files route to fit web server data
1 parent 9eb6e90 commit 1807ae0

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

server/routes/files.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
router.get('/files(\/?[a-zA-Z0-9_-]?)*', function(clientRequest, clientResponse) {
88
var options = {
99
host: '127.0.0.1',
10-
path: '/files',
10+
path: clientRequest.url.replace('%2F', '/').replace('/files', '/files/list/[email protected]'),
1111
port: '3030',
1212
method: 'GET'};
1313

@@ -18,16 +18,14 @@
1818

1919
try {
2020
data = JSON.parse(chunk);
21-
if (data.error === 'undefined') {
22-
data.forEach(function(item) {
23-
files.push({
24-
name: item.fileName || '',
25-
type: 'text',
26-
size: item.fileSize || '',
27-
modified: '',
28-
sharedWith: []});
29-
});
30-
}
21+
data.forEach(function(item) {
22+
files.push({
23+
name: item.fileName || '',
24+
type: item.extension || (item.folder === true ? 'dir' : ''),
25+
size: item.fileSize || '',
26+
modified: '',
27+
sharedWith: []});
28+
});
3129
} catch(error) {
3230
return console.error(error.message);
3331
}

0 commit comments

Comments
 (0)