Skip to content

Commit

Permalink
fix(core): Path in remove not normalized (#3671)
Browse files Browse the repository at this point in the history
* fix(core): Path in remove not normalized

Signed-off-by: Xuanwo <[email protected]>

* Fix tests

Signed-off-by: Xuanwo <[email protected]>

---------

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Nov 27, 2023
1 parent 682d38c commit d789892
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/src/types/operator/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,8 @@ impl Operator {
/// # }
/// ```
pub async fn remove_via(&self, input: impl Stream<Item = String> + Unpin) -> Result<()> {
let input = input.map(|v| normalize_path(&v));

if self.info().full_capability().batch {
let mut input = input
.map(|v| (v, OpDelete::default().into()))
Expand Down
13 changes: 12 additions & 1 deletion core/tests/behavior/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,18 @@ pub async fn test_remove_one_file(op: Operator) -> Result<()> {
let path = uuid::Uuid::new_v4().to_string();
let (content, _) = gen_bytes(op.info().full_capability());

op.write(&path, content).await.expect("write must succeed");
op.write(&path, content.clone())
.await
.expect("write must succeed");

op.remove(vec![path.clone()]).await?;

// Stat it again to check.
assert!(!op.is_exist(&path).await?);

op.write(&format!("/{path}"), content)
.await
.expect("write must succeed");

op.remove(vec![path.clone()]).await?;

Expand Down

0 comments on commit d789892

Please sign in to comment.