Hello everyone,
I’m new to Tus. Currently I am building a tus node server to store files on S3 minIO. Because I wanted to store files in different folders on S3, I edited the functions “namingFunction”, “generateUrl”, and “getFileIdFromRequest”. The results I got were quite good and satisfied.
When I want to download a file, I am forced to send a GET request with the path being the entire directory path I uploaded. For example: “127.0.0.1:1080/files/user/avatar/{file_id}”. That makes me feel like my application is not very secure. My idea is, I would let the client just store and pass up the {file_id} (e.g. “127.0.0.1:1080/files/{file_id}”), and then would navigate to the main path body.
I plan to handle that in the “onIncomingRequest(req, res, uploadId)” function. I tried changing “req.url” or “uploadId” to the correct path but neither worked.
Is my idea possible and how would I do it, any help, suggestions or examples would be appreciated!
Thanks everyone!
You can implement your own GET handler. Then you could use logic how you see fit to match that file ID to the actual path in the store.
1 Like
Dear sir,
I tried it but it didn’t work as I expected. The server can only catch requests with the correct path, for example “/files/avatar/file_1”. Meanwhile I want to be able to catch all requests starting with the path “/files/” (e.g. “/files/avatar/file_2” or “/files/avatar/file_3”, …)