Comments (4)
I see what you mean.
I do have that extra logic elsewhere:
- Browser sends initial request to other server
- I check auth and return path to folder where user can upload their file
- Browser initiates real transfer request to tus server and also sends filename and path with the metadata (path is protected with hmac so user can't tamper with it)
- Naming function is used to put the file with real name in correct folder
I should have put my complete code in my initial example, apologies.
from tus-node-server.
Hi, you shouldn't use namingFunction
to change the default unique ID to a non-unique file name. This will cause file corruption sooner or later if people upload files with the same name!
What probably makes most sense is to have #594, then you can change the file name in the metadata
and the store will save that new metadata. You can keep the actual files uniquely generated. In tus in generally works like this, original file name in the .info
or .json
file and a unique file adjacent to it.
Performing a HEAD request will send back the metadata whenever the client likes to know it.
from tus-node-server.
I see, thanks 👍
I'm starting to think maybe tus is not the best for my use case. I want users to be able to overwrite existing files as they handle their own files. That's why I need to display the real file names without doing any HEAD requests (or querying my db where I would have stored the real hierarchy).
from tus-node-server.
You can override files, you just want to do it safely and explicitly. If you only use namingFunction
without extra logic that puts each user's files in their own folder, a user can corrupt other user's files.
You can remove the old file in onUploadFinish
to "override" it. But as of now, you would need to perform a HEAD to see the changes. It's not ideal but it's not going to be a problem either I reckon.
In a future version of the tus spec, it would be nice to send back Upload-Metadata
in the POST request.
from tus-node-server.
Related Issues (20)
- S3-store doen't work with Cloudflare R2 storage HOT 2
- Respect X-Forwarded-Port and X-Forwarded-Prefix as well HOT 2
- serverless integration HOT 1
- Upload fail after 10min request HOT 3
- Error installing 1.4.0 from npm HOT 2
- tus-node-server and ietf HOT 11
- Simultaneous file upload leads to corrupted files HOT 2
- Is there a way to pass variables between the `onUploadCreate` and the `onUploadFinish` functions? HOT 12
- Allow hooks to override metadata HOT 1
- Recommended nginx configuration HOT 2
- [S3Store] 0 bytes files are not uploaded HOT 1
- onUploadFinish should be able to alter response body HOT 5
- "Store files in custom nested directories" example fails with can't patch error HOT 10
- @tus/[email protected] breaking upload. 404 error HOT 8
- Upload using tus but serve files directly from s3 or using nginx without tus server HOT 7
- S3store creating extra .info file HOT 1
- @tus/s3-store incompatibility with R2 HOT 1
- generateUrl always returns http protocol HOT 4
- `generateUrl` returns insecure URL and subsequent chunk uploads fail HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tus-node-server.