Skip to content

Commit

Permalink
Fix aliyun drive
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Aug 26, 2024
1 parent 0c12d40 commit 38d67ed
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions core/src/services/aliyun_drive/lister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,19 @@ impl oio::PageList for AliyunDriveLister {
};

let offset = if ctx.token.is_empty() {
if !parent.path.ends_with('/') {
// List "dir" should contains "dir/".
let path = if !parent.path.starts_with('/') {
format!("/{}", parent.path)
} else {
parent.path.clone()
};
ctx.entries.push_back(Entry::new(
&format!("{}/", path),
Metadata::new(EntryMode::DIR).with_last_modified(
parent
.updated_at
.parse::<chrono::DateTime<Utc>>()
.map_err(|e| {
Error::new(ErrorKind::Unexpected, "parse last modified time")
.set_source(e)
})?,
),
));
}
// Push self into the list result.
ctx.entries.push_back(Entry::new(
&parent.path,
Metadata::new(EntryMode::DIR).with_last_modified(
parent
.updated_at
.parse::<chrono::DateTime<Utc>>()
.map_err(|e| {
Error::new(ErrorKind::Unexpected, "parse last modified time")
.set_source(e)
})?,
),
));
None
} else {
Some(ctx.token.clone())
Expand All @@ -110,11 +103,7 @@ impl oio::PageList for AliyunDriveLister {
let n = result.items.len();

for item in result.items {
let path = if parent.path.starts_with('/') {
build_abs_path(&parent.path, &item.name)
} else {
build_abs_path(&format!("/{}", &parent.path), &item.name)
};
let path = build_abs_path(&parent.path, &item.name);

let (path, md) = if item.path_type == "folder" {
let path = format!("{}/", path);
Expand Down

0 comments on commit 38d67ed

Please sign in to comment.