Skip to content
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

bug: 使用 node.js webdav 包和 fs readable stream 无法上传到阿里云盘 open #5256

Closed
4 tasks done
yjl9903 opened this issue Sep 21, 2023 · 3 comments
Closed
4 tasks done
Labels
bug Something isn't working stale No activity for more than 30 days

Comments

@yjl9903
Copy link

yjl9903 commented Sep 21, 2023

Please make sure of the following things

  • I have read the documentation.
    我已经阅读了文档

  • I'm sure there are no duplicate issues or discussions.
    我确定没有重复的issue或讨论。

  • I'm sure it's due to AList and not something else(such as Network ,Dependencies or Operational).
    我确定是AList的问题,而不是其他原因(例如网络依赖操作)。

  • I'm sure this issue is not fixed in the latest version.
    我确定这个问题在最新版本中没有被修复。

AList Version / AList 版本

v3.27.0

Driver used / 使用的存储驱动

阿里云盘 open

Describe the bug / 问题描述

在 Node.js 中使用 webdav 包,无法通过 stream 上传文件到 alist 的阿里云盘 open 驱动 (经测试, 同样方式可以上传到本机存储驱动, 其他驱动能否工作未知)

复现示例代码:

import fs from 'fs';
import { createClient } from 'webdav';

const client = createClient('http://localhost:5244/dav', {
  username: 'admin',
  password: 'abcdef'
});

function main() {
  const read = fs.createReadStream('README.md');
  const write = client.createWriteStream('/aliyundriver/README.md');

  return new Promise<void>((res, rej) => {
    read.once('error', (err) => rej(err));
    read.once('close', () => {
      console.log('Read stream is closed');
      res();
    });
    read.pipe(write);
  });
}

main();

Reproduction / 复现链接

见上

Config / 配置

  1. 设置 admin 密码为 abcdef

  2. 添加一个挂载到 /aliyundriver/ 的阿里云盘 open 挂载。

其余均为默认配置:

{
  "force": false,
  "site_url": "",
  "cdn": "",
  "jwt_secret": "XnMp2yt8lVIwfZ4L",
  "token_expires_in": 48,
  "database": {
    "type": "sqlite3",
    "host": "",
    "port": 0,
    "user": "",
    "password": "",
    "name": "",
    "db_file": "/Users/xlor/Library/Application Support/ci.nn.alist/data.db",
    "table_prefix": "x_",
    "ssl_mode": ""
  },
  "scheme": {
    "address": "0.0.0.0",
    "http_port": 5244,
    "https_port": -1,
    "force_https": false,
    "cert_file": "",
    "key_file": "",
    "unix_file": "",
    "unix_file_perm": ""
  },
  "temp_dir": "/Users/xlor/Library/Application Support/ci.nn.alist/temp",
  "bleve_dir": "/Users/xlor/Library/Application Support/ci.nn.alist/bleve",
  "log": {
    "enable": true,
    "name": "/Users/xlor/Library/Application Support/ci.nn.alist/log/log.log",
    "max_size": 50,
    "max_backups": 30,
    "max_age": 28,
    "compress": false
  },
  "delayed_start": 0,
  "max_connections": 0,
  "tls_insecure_skip_verify": true
}

Logs / 日志

[GIN] 2023/09/21 - 17:50:04 | 200 | 242.918µs | ::1 | GET "/p/desktop/README.md?ts=1695289804420"
2023/09/21 17:51:14 [Recovery] 2023/09/21 - 17:51:14 panic recovered:
runtime error: makeslice: cap out of range
/usr/local/go/src/runtime/slice.go:33 (0x1000546f2)
/usr/local/go/src/runtime/slice.go:100 (0x1000546df)
/source/internal/stream/stream.go:90 (0x10059ebcb)
/source/drivers/aliyundrive_open/upload.go:246 (0x100ec5bd1)
/source/drivers/aliyundrive_open/driver.go:196 (0x100ec3713)
/source/internal/op/fs.go:531 (0x1004c554d)
/source/internal/fs/put.go:54 (0x1009621d0)
/source/internal/fs/fs.go:96 (0x10096022e)
/source/server/webdav/webdav.go:336 (0x1011dd0a4)
/source/server/webdav/webdav.go:64 (0x1011da8da)
/source/server/webdav.go:46 (0x1011e7167)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1011e7aa6)
/source/server/webdav.go:112 (0x1011e7a94)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1011722e5)
/source/server/middlewares/check.go:14 (0x1011722d3)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x100951379)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0x100951367)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x10095051d)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 (0x1009504ec)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x10094f5da)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 (0x10094f26d)
/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 (0x10094ed9c)
/usr/local/go/src/net/http/server.go:2938 (0x10034320d)
/usr/local/go/src/net/http/server.go:2009 (0x10033f0f3)
/usr/local/go/src/runtime/asm_amd64.s:1650 (0x1000736e0)
[GIN] 2023/09/21 - 17:51:14 | 500 | 613.027873ms | ::1 | PUT "/dav/aliyundriver/README.md"

@yjl9903 yjl9903 added the bug Something isn't working label Sep 21, 2023
@welcome
Copy link

welcome bot commented Sep 21, 2023

Thanks for opening your first issue here! Be sure to follow the issue template!

@xhofe
Copy link
Collaborator

xhofe commented Oct 1, 2023

当前上传接口必须获取到文件的大小,即Content-Length头, 否则无法处理。

Copy link

stale bot commented Nov 14, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No activity for more than 30 days label Nov 14, 2023
@yjl9903 yjl9903 closed this as completed Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale No activity for more than 30 days
Projects
None yet
Development

No branches or pull requests

2 participants