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

File & directory deletion feature #1093

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

cyqsimon
Copy link
Contributor

@cyqsimon cyqsimon commented Apr 3, 2023

Closes #397.

Todo

  • CLI options
  • Backend API
  • Frontend controls
  • Tests

@cyqsimon
Copy link
Contributor Author

cyqsimon commented Apr 3, 2023

miniserve/src/main.rs

Lines 329 to 330 in 82dd826

// Allow file upload
app.service(web::resource("/upload").route(web::post().to(file_upload::upload_file)));

I am curious why the upload feature is implemented like so. I guess it's good for unforeseen future extensibility, but there is semantic duplication between the /upload endpoint and the POST method.

The real question I want to ask, is should I implement the deletion feature in a similar manner? I.e. something like this:

app.service(web::resource("/delete").route(web::delete().to(file_rm::rm_file)));

@svenstaro
Copy link
Owner

Are you suggesting it might have been better to just have POST always try to upload stuff? It would be simpler for sure but as you are saying, it's not great if we ever want a second POST for something. I think this is currently an ok compromise.

I see how this is a bit of a conundrum with delete. I also want to add WebDAV at some point and that will introduce even more semantics. Perhaps it's the best to go with what you suggested just now and eat the semantic duplication for the time being. It's not like it can't be changed later.

@bgusach
Copy link

bgusach commented Aug 25, 2023

Hi,

unfortunately I can't directly help... just wanted to say that I appreciate the effort and if it gets done at some point, my life would be somehow better :)

@cyqsimon
Copy link
Contributor Author

Hi,

unfortunately I can't directly help... just wanted to say that I appreciate the effort and if it gets done at some point, my life would be somehow better :)

Thanks for reminding me. I have too many things on hand and honestly just forgot about this whole matter. I will find some time to work on it this week, hopefully.

Comment on lines +287 to +298
td.actions-cell .rm_form button {
background: var(--rm_button_background);
color: var(--rm_button_text_color);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suck at visual design. So any styling improvement suggestion is welcomed.

@cyqsimon
Copy link
Contributor Author

cyqsimon commented Jan 29, 2024

Rebased on #1331.

@cyqsimon
Copy link
Contributor Author

Rebased on master.

@cyqsimon
Copy link
Contributor Author

Rebased on master.

@svenstaro
Copy link
Owner

Could you add some tests? Since this is going to be deleting things, it needs some proper tests.

@cyqsimon
Copy link
Contributor Author

cyqsimon commented Jul 7, 2024

Could you add some tests? Since this is going to be deleting things, it needs some proper tests.

Yeah I'm working on that on and off. The tests are actually written but several are failing. My original intention was to combine the tests and the fixes into one commit, but I guess there's no harm in splitting them up. I'll push the tests first and then look to fix them.

@cyqsimon
Copy link
Contributor Author

cyqsimon commented Jul 7, 2024

If you can spare some time, please take a look at the test suite; make sure they are testing the correct behaviour. Thanks.

@svenstaro
Copy link
Owner

Yeah I'm working on that on and off. The tests are actually written but several are failing. My original intention was to combine the tests and the fixes into one commit, but I guess there's no harm in splitting them up. I'll push the tests first and then look to fix them.

No worries. There's no rush to get this in. Just take your time and make sure things look good.

If you can spare some time, please take a look at the test suite; make sure they are testing the correct behaviour. Thanks.

I will try to squeeze a review in but no promises, I'm fairly low on time currently.

@cyqsimon
Copy link
Contributor Author

Rebased on #1454.

@cyqsimon
Copy link
Contributor Author

This should be ready now, finally. Everything works as expected, as far as I can tell. But you may wish to merge the other PR first.

@cyqsimon cyqsimon marked this pull request as ready for review September 15, 2024 16:30
@svenstaro
Copy link
Owner

Needs a rebase and then I will do a proper review. :)

@cyqsimon
Copy link
Contributor Author

Actually, let me do an interactive rebase to reorganise things. Then it'd be a bit tidier.

@qtekk
Copy link

qtekk commented Oct 16, 2024

hey, how's the feature going?

@cyqsimon
Copy link
Contributor Author

hey, how's the feature going?

Implementation is complete. Just waiting on review.

@svenstaro You got time to take a look?

@svenstaro
Copy link
Owner

I will take some time. Might take a look on the weekend.

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 this pull request may close these issues.

How about add "delete file" feature?
4 participants