Skip to content

/files route bug #5

Description

@Gabriel250903

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,
})
);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions