Skip to content

Commit

Permalink
jfrog doesn't support copy
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Feb 27, 2024
1 parent 33ef406 commit 1deac3f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/services/webdav/jfrog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ runs:
OPENDAL_WEBDAV_ENDPOINT=http://127.0.0.1:8081/artifactory/example-repo-local
OPENDAL_WEBDAV_USERNAME=admin
OPENDAL_WEBDAV_PASSWORD=password
OPENDAL_WEBDAV_DISABLE_COPY=true
EOF
20 changes: 11 additions & 9 deletions core/src/services/webdav/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ pub struct WebdavConfig {
pub token: Option<String>,
/// root of this backend
pub root: Option<String>,
/// WebDAV Service doesn't support copy.
pub disable_copy: bool,
}

impl Debug for WebdavConfig {
Expand Down Expand Up @@ -157,15 +159,13 @@ impl Builder for WebdavBuilder {
type Accessor = WebdavBackend;

fn from_map(map: HashMap<String, String>) -> Self {
let mut builder = WebdavBuilder::default();
let config = WebdavConfig::deserialize(ConfigDeserializer::new(map))
.expect("config deserialize must succeed");

map.get("root").map(|v| builder.root(v));
map.get("endpoint").map(|v| builder.endpoint(v));
map.get("username").map(|v| builder.username(v));
map.get("password").map(|v| builder.password(v));
map.get("token").map(|v| builder.token(v));

builder
WebdavBuilder {
config,
http_client: None,
}
}

fn build(&mut self) -> Result<Self::Accessor> {
Expand Down Expand Up @@ -206,6 +206,7 @@ impl Builder for WebdavBuilder {
Ok(WebdavBackend {
endpoint: endpoint.to_string(),
authorization: auth,
disable_copy: self.config.disable_copy,
root,
client,
})
Expand All @@ -218,6 +219,7 @@ pub struct WebdavBackend {
endpoint: String,
root: String,
client: HttpClient,
disable_copy: bool,

authorization: Option<String>,
}
Expand Down Expand Up @@ -258,7 +260,7 @@ impl Accessor for WebdavBackend {
create_dir: true,
delete: true,

copy: true,
copy: !self.disable_copy,

rename: true,

Expand Down

0 comments on commit 1deac3f

Please sign in to comment.