Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/files route bug #5

Open
LunaryX opened this issue Sep 23, 2023 · 0 comments
Open

/files route bug #5

LunaryX opened this issue Sep 23, 2023 · 0 comments

Comments

@LunaryX
Copy link

LunaryX commented Sep 23, 2023

I've found a bug for the /files route to show all the files found in the directory and i encountered a bug, it throws this error whenever i try to go to "localhost:3200/files". I've actually managed to fix it and i can provide the working code as well.

Error:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at new NodeError (node:internal/errors:405:5)
at validateString (node:internal/validators:162:11)
at Object.join (node:path:429:7)
at LocalFiles.idToPath (C:\Users\gaby2\Desktop\filemanager-node-master\node_modules\wfs-local\lib\LocalFiles.js:203:44)
at LocalFiles. (C:\Users\gaby2\Desktop\filemanager-node-master\node_modules\wfs-local\lib\LocalFiles.js:48:35)
at Generator.next ()
at C:\Users\gaby2\Desktop\filemanager-node-master\node_modules\wfs-local\lib\LocalFiles.js:8:71
at new Promise ()
at __awaiter (C:\Users\gaby2\Desktop\filemanager-node-master\node_modules\wfs-local\lib\LocalFiles.js:4:12)
at LocalFiles.list (C:\Users\gaby2\Desktop\filemanager-node-master\node_modules\wfs-local\lib\LocalFiles.js:42:16) {
code: 'ERR_INVALID_ARG_TYPE'
}

Working code :

app.get("/files", async (req, res, next) => {
res.send(
await drive.list("/", {
skipFiles: false,
subFolders: false,
exclude: (a) => a.indexOf(".") === 0,
})
);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant