svenstaro/miniserve

set upload folder

Closed this issue · 4 comments

Hey there,
I would love to have a feature that allowed me to use the -u flag with a folder, so only that folder can be uploaded to.
Can you add this?
Thanks!

So something like --restrict-upload-dir and then trying to upload into any other directory would give an error? Sounds like a neat little feature. Would you like to take a stab at this?

So something like --restrict-upload-dir and then trying to upload into any other directory would give an error? Sounds like a neat little feature. Would you like to take a stab at this?

Maybe not even an error (At least not in the web UI). More that the Upload Button only appears in the predifined directory(s) (A list would definitely be useful)

Sadly I am 100% unfamiliar with rust, and this does probably require more knowledge than just copy-pasting stuff around. Someone else will have to do this.

Hi,

looking for an opportunity for some first Rust experience, I've taken a stab: https://github.com/jonasdiemer/miniserve/tree/restrict-upload-dir

Please consider it a rough prototype - esp. the area in file_upload.rs doesn't feel very idiomatic...

@svenstaro, I'd be happy if you could take a look and suggest what to add/change/improve. Thanks!

Make a draft PR and I'll take a look.