Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about add "delete file" feature? #397

Open
Nillouise opened this issue Oct 16, 2020 · 12 comments · May be fixed by #1093
Open

How about add "delete file" feature? #397

Nillouise opened this issue Oct 16, 2020 · 12 comments · May be fixed by #1093

Comments

@Nillouise
Copy link

After I do some research on many mini http server, miniserve is a great work, which have authentication. But I also have found many mini http servers did not have "delete file" feature including miniserve.

I think "delete file" will be a good point to a mini http server, especially it can combine the authntication.

@NOBLES5E
Copy link

Another Rust static file server with file deletion feature but less friendly UI: https://github.com/thecoshman/http.

@cyqsimon
Copy link
Contributor

I have some time and would like to work on this. But first I have some questions regarding CLI flags.

There are several options as I see it:

  1. No new flags. Piggy-back on the existing [-u|--upload-files] and [-U|--mkdir] flags. -u allows rm and -U allows rm -rf.
  2. One new flag that allows both deleting files and directories.
  3. Two flags, one for files and one for directories.

The later options allow more granular control, but it could be teetering on the edge of over-engineering.

I personally like option 2 the most, because:

  1. compared to option 1, the granularity is justified, especially considering its relationship to the existing [-o|--overwrite-files] flag.
  2. it's not overdoing the granularity either, because it makes little sense to not allow removing entire directories, when a user can just delete all the files one by one.
  3. There are already many existing short flags. None of -r, -d, -D is available. The only reasonable one remaining is -R, which makes only 1 flag desirable.

@svenstaro let me know what you think.

@svenstaro
Copy link
Owner

I think option 2. does indeed sound reasonable. Would be happy if you wanted to take a stab at this. Should be fairly easy too. Make sure to use non-blocking deletion though as it can take a long time to recursively delete some stuff.

@cyqsimon cyqsimon linked a pull request Apr 3, 2023 that will close this issue
4 tasks
@humbinal
Copy link

Has this feature been completed? In what version can it be used?

@cyqsimon
Copy link
Contributor

cyqsimon commented May 14, 2023

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job.

TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

@humbinal
Copy link

@cyqsimon Ok, I see. Thank you very much !

@gocpplua
Copy link

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job.

TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

Has this feature been completed?

@cyqsimon
Copy link
Contributor

cyqsimon commented Jan 26, 2024

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job.
TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

Has this feature been completed?

If I had a cent for every time I promised to do something then promptly forgot about it, I'd be doing that all day. No, probably it's enough to buy me a Big Mac or something.

Jokes aside, thanks for reminding me. Sometimes I do need some peer pressure to stop my procrastination. I've finished the prototype implementation today; please check out #1093. You can try it out like so:

cargo run -- --rm-files -- <DIR>

Note that in the current implementation, deletion is permanent. So it's probably a good idea to try it out on a temp dir. I'm not responsible for any of your data loss.

@gocpplua
Copy link

gocpplua commented Feb 4, 2024

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job.
TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

Has this feature been completed?

If I had a cent for every time I promised to do something then promptly forgot about it, I'd be doing that all day. No, probably it's enough to buy me a Big Mac or something.

Jokes aside, thanks for reminding me. Sometimes I do need some peer pressure to stop my procrastination. I've finished the prototype implementation today; please check out #1093. You can try it out like so:

cargo run -- --rm-files -- <DIR>

Note that in the current implementation, deletion is permanent. So it's probably a good idea to try it out on a temp dir. I'm not responsible for any of your data loss.

Haha, thank you very much

@jmjoy
Copy link

jmjoy commented Jun 26, 2024

I also need this feature, is there any progress on the request?

@cyqsimon
Copy link
Contributor

I also need this feature, is there any progress on the request?

Yeah I kinda left it there after doing the initial implementation. There were definitely still a few problems (something to do with path escaping IIRC) so I'll need to add tests.

At the moment I'm busier IRL than ever, so if anyone wants to help me write the tests that would be appreciated. See #1093.

@cyqsimon
Copy link
Contributor

Notifying everyone that the feature is now complete with passing tests, awaiting feedback and review. Feel free to play around and try to break it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants