-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
base: master
Are you sure you want to change the base?
Conversation
c6a083c
to
6f082ad
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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:.*}") |
There was a problem hiding this comment.
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?
use dav_server::{davpath::DavPath, fs::*, localfs::LocalFs}; | ||
use futures::{future::ready, StreamExt, TryFutureExt}; | ||
use std::path::{Component, Path}; |
There was a problem hiding this comment.
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.
#[derive(Clone)] | ||
pub struct RestrictedFs { | ||
local: Box<LocalFs>, | ||
allow_hidden: bool, | ||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
Please rebase this! |
Adds read-only webdav support by (when indexing isn't disabled) routing OPTIONS/PROPFIND requests to a
DavHandler
from thewebdav-server
crate. Hidden files are excluded via a customDavFileSystem
.