hoslo commented on code in PR #3771:
URL: 
https://github.com/apache/incubator-opendal/pull/3771#discussion_r1429928799


##########
core/src/services/seafile/lister.rs:
##########
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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 std::sync::Arc;
+
+use async_trait::async_trait;
+use http::{header, Request, StatusCode};
+use serde::Deserialize;
+
+use super::core::SeafileCore;
+use super::error::parse_error;
+
+use crate::raw::oio::Entry;
+use crate::raw::*;
+use crate::*;
+
+pub struct SeafileLister {
+    core: Arc<SeafileCore>,
+
+    path: String,
+}
+
+impl SeafileLister {
+    pub(super) fn new(core: Arc<SeafileCore>, path: &str) -> Self {
+        SeafileLister {
+            core,
+            path: path.to_string(),
+        }
+    }
+}
+
+#[async_trait]
+impl oio::PageList for SeafileLister {
+    async fn next_page(&self, ctx: &mut oio::PageContext) -> Result<()> {
+        let path = build_rooted_abs_path(&self.core.root, &self.path);
+
+        let auth_info = self.core.get_auth_info().await?;
+
+        let url = format!(
+            "{}/api2/repos/{}/dir/?p={}",
+            self.core.server,
+            auth_info.repo_id,
+            percent_encode_path(&path)
+        );
+
+        let req = Request::get(url);
+
+        let req = req
+            .header(header::AUTHORIZATION, format!("Token {}", 
auth_info.token))
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        let resp = self.core.send(req).await?;
+
+        let status = resp.status();
+
+        match status {
+            StatusCode::OK => {
+                let resp_body = &resp.into_body().bytes().await?;
+                let infos = serde_json::from_slice::<Vec<Info>>(resp_body)
+                    .map_err(new_json_deserialize_error)?;
+
+                for info in infos {
+                    if !info.name.is_empty() {
+                        let rel_path =
+                            build_rel_path(&self.core.root, &format!("{}{}", 
path, info.name));
+
+                        let entry = if info.type_field == "file" {
+                            let meta = Metadata::new(EntryMode::FILE)
+                                
.with_last_modified(parse_datetime_from_from_timestamp_millis(

Review Comment:
   add a parse_datetime_from_from_timestamp func to fix it



##########
fixtures/seafile/docker-compose-seafile.yml:
##########
@@ -0,0 +1,61 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
+version: "3.8"
+services:
+  db:
+    image: mariadb:10.11
+    container_name: seafile-mysql
+    environment:
+      - MYSQL_ROOT_PASSWORD=db_dev  # Requested, set the root's password of 
MySQL service.
+      - MYSQL_LOG_CONSOLE=true
+    # volumes:
+    #   - /opt/seafile-mysql/db:/var/lib/mysql  # Requested, specifies the 
path to MySQL data persistent store.
+    networks:
+      - seafile-net
+
+  memcached:
+    image: memcached:1.6.18
+    container_name: seafile-memcached
+    entrypoint: memcached -m 256
+    networks:
+      - seafile-net
+          
+  seafile:
+    image: seafileltd/seafile-mc:latest
+    container_name: seafile
+    ports:
+      - "80:80"
+#     - "443:443"  # If https is enabled, cancel the comment.

Review Comment:
   fix



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to