Note that there are many security concerns with this, notably the fact that there is no input validation on the id
path segment which means you can get the content of any file (e.g. http://localhost:3000/src%2Fmain.rs
). It’s also very easy to scrape the content of all the files because the IDs are easy to predict. When the server reboots, you will overwrite previously written files because the counter starts back at zero. Using a UUID
would probably mostly solve both these issues.
Cargo dist! Here’s a nice workflow you can use : https://blog.orhun.dev/automated-rust-releases/