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

add read-only webdav support #1415

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

add read-only webdav support #1415

wants to merge 2 commits into from

Conversation

ahti
Copy link
Contributor

@ahti ahti commented May 13, 2024

Adds read-only webdav support by (when indexing isn't disabled) routing OPTIONS/PROPFIND requests to a DavHandler from the webdav-server crate. Hidden files are excluded via a custom DavFileSystem.

@ahti ahti force-pushed the webdav branch 5 times, most recently from c6a083c to 6f082ad Compare May 14, 2024 02:04
@ahti ahti changed the title draft: add read-only webdav support add read-only webdav support May 24, 2024
Copy link
Owner

@svenstaro svenstaro left a comment

Choose a reason for hiding this comment

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

The webdav functionality should likely be put behind a flag. I suppose most people wouldn't want to run it with webdav activated.

Also, can you produce a test that shows that webdav at least works in some fashion?

@@ -308,7 +315,9 @@ fn configure_header(conf: &MiniserveConfig) -> middleware::DefaultHeaders {
/// This is where we configure the app to serve an index file, the file listing, or a single file.
fn configure_app(app: &mut web::ServiceConfig, conf: &MiniserveConfig) {
let dir_service = || {
let mut files = actix_files::Files::new("", &conf.path);
// use routing guard so propfind and options requests fall through to the webdav handler
Copy link
Owner

Choose a reason for hiding this comment

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

Do we want all Options requests to fall through? Can we be more specific?

// order is important: the dir service above is checked first, but has a method guard,
// so options and propfind go here. if this service was registered first, it would swallow the gets/heads
app.service(
web::resource("/{tail:.*}")
Copy link
Owner

Choose a reason for hiding this comment

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

Where does this come from?

Comment on lines +1 to +3
use dav_server::{davpath::DavPath, fs::*, localfs::LocalFs};
use futures::{future::ready, StreamExt, TryFutureExt};
use std::path::{Component, Path};
Copy link
Owner

Choose a reason for hiding this comment

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

Give this module a description.

Comment on lines +5 to +9
#[derive(Clone)]
pub struct RestrictedFs {
local: Box<LocalFs>,
allow_hidden: bool,
}
Copy link
Owner

Choose a reason for hiding this comment

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

Give this a proper description of what this is supposed to do and why we need it.

}
}

fn check_path(path: &DavPath) -> bool {
Copy link
Owner

Choose a reason for hiding this comment

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

Describe what the idea here is.

@svenstaro
Copy link
Owner

Please rebase this!

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.

2 participants