-
Notifications
You must be signed in to change notification settings - Fork 592
feat(webdav): add list and improve create #1330
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
Merged
Merged
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
9e57129
add initial
imWildCat 253a701
add list response
imWildCat 51f0087
add webdav list_response parser
imWildCat 2b56014
add more response
imWildCat 9660bfb
RFR: making PUT more generic
imWildCat 7124140
progress implementatin
imWildCat a587aec
add dir_stream
imWildCat fc278a2
make fields public
imWildCat 651fd39
finish backend
imWildCat 9a7460a
finish
imWildCat 35c713f
rename to DirStream
imWildCat 099049d
add file header
imWildCat 975461e
fix lint
imWildCat d6fb97a
update comments
imWildCat 9b80cf5
set_capabilities
imWildCat 04dd2e9
address backend feedbacks
imWildCat 0a361f3
refine lock & clean up
imWildCat 3af0ddd
fix logic
imWildCat f458d12
fix lint: dir_stream.rs
imWildCat 9514fd0
trying to fix
imWildCat 7e64e93
Update src/services/webdav/dir_stream.rs per comment from @ClSlaid
imWildCat aca39e6
dav_ext_methods PROPFIND;
imWildCat ca2b122
PROPFIND
imWildCat ed5ee6e
fix formatting
imWildCat 8c9be54
improve nginx config
imWildCat 006f30d
Install nginx full
Xuanwo e8af447
Fix apt install
Xuanwo ca51c84
import module
Xuanwo 08a0bf1
fix lint
imWildCat 3fbc28b
nginx
imWildCat 052baa4
build relative path
imWildCat 34f8698
Merge remote-tracking branch 'upstream/main' into webdav-list-op
imWildCat 1f7b647
trying to fix self.root
imWildCat 59c3123
add default depth for propfind
imWildCat 09d89f8
feat: support auth for HttpBackend (#1359)
Young-Flash e9e18f6
feat: Add batch delete support (#1357)
Xuanwo 69b40d4
docs: clarify about opendal user defined client (#1356)
ClSlaid 1b2589e
fix(webhdfs): should prepend http:// scheme (#1354)
ClSlaid 538fb18
ci: Pin time <= 0.3.17 until we decide to bump MSRV (#1361)
Xuanwo 9da4832
ci: Only run service test on changing (#1363)
Xuanwo 2ebd0fe
Merge branch 'main' into webdav-list-op
imWildCat 2abeb6a
add auth for propfind
imWildCat cf9f215
fix list op
imWildCat 1c621af
fix root path
imWildCat cd67d5d
add xml header
imWildCat 9ed2094
fix prop xml
imWildCat 6b42f6b
remove TODO
imWildCat b04b300
skip current path while listing
imWildCat 1ff5211
Merge branch 'main' into webdav-list-op
imWildCat a86f1a8
handle 404 for dir
imWildCat 7f48a5c
add MKCOL to fix mkdir
imWildCat 2e1e966
add MKCOL for dirs
imWildCat 0ad0624
Merge remote-tracking branch 'upstream/main' into webdav-list-op
imWildCat ab27326
end
imWildCat ee9d7b4
create dir recursively
imWildCat ef69945
handle StatusCode::METHOD_NOT_ALLOWED
imWildCat bf97bcc
fix iteration
imWildCat aa4d2b4
fix typo
imWildCat 63acd2d
fix dir creation
imWildCat 56a88ea
fix write
imWildCat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright 2022 Datafuse Labs. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use crate::raw::build_rel_path; | ||
use crate::Result; | ||
use crate::{raw::output, ObjectMetadata, ObjectMode}; | ||
use async_trait::async_trait; | ||
|
||
use super::list_response::Multistatus; | ||
|
||
pub struct DirStream { | ||
root: String, | ||
path: String, | ||
size: usize, | ||
multistates: Multistatus, | ||
} | ||
|
||
impl DirStream { | ||
pub fn new(root: &str, path: &str, multistates: Multistatus, limit: Option<usize>) -> Self { | ||
Self { | ||
root: root.into(), | ||
path: path.into(), | ||
size: limit.unwrap_or(1000), | ||
multistates, | ||
} | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl output::Page for DirStream { | ||
async fn next_page(&mut self) -> Result<Option<Vec<output::Entry>>> { | ||
Xuanwo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let mut oes: Vec<output::Entry> = Vec::new(); | ||
for _ in 0..self.size { | ||
if let Some(de) = self.multistates.response.pop() { | ||
let path = de.href.clone(); | ||
let normalized_path = &if self.root != path { | ||
build_rel_path(&self.root, &path) | ||
} else { | ||
path | ||
}; | ||
|
||
if normalized_path.eq(&self.path) { | ||
// WebDav server may return the current path as an entry. | ||
continue; | ||
} | ||
|
||
let entry = if de.propstat.prop.resourcetype.value | ||
== Some(super::list_response::ResourceType::Collection) | ||
{ | ||
output::Entry::new(normalized_path, ObjectMetadata::new(ObjectMode::DIR)) | ||
} else { | ||
output::Entry::new(normalized_path, ObjectMetadata::new(ObjectMode::FILE)) | ||
}; | ||
oes.push(entry); | ||
} | ||
} | ||
|
||
Ok(if oes.is_empty() { None } else { Some(oes) }) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.