Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

挂载另一个 Alist 时无法正常调用下载 #1340

Closed
3 tasks done
Raobee opened this issue Jul 14, 2022 · 1 comment
Closed
3 tasks done

挂载另一个 Alist 时无法正常调用下载 #1340

Raobee opened this issue Jul 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@Raobee
Copy link

Raobee commented Jul 14, 2022

Please make sure of the following things

  • I have read the documentation.
  • I'm sure there are no duplicate issues or discussions.
  • I'm sure it's due to alist and not something else(such as Dependencies or Operational).

Alist Version / Alist 版本

v2.6.1

Driver used / 使用的存储驱动

alist

Describe the bug / 问题描述

挂载另一个 Alist 时无法正常调用下载

通过添加其他的 Alist 服务挂载另一个 Alist 时,如果指定挂载根目录路径不为 / (例如设置为 /ali/live),在前端调用下载的时候,后端返回的下载链接不完整,缺少目标 Alist 的根目录路径,参见 https://github.com/alist-org/alist/blob/v2/drivers/alist/driver.go#L116 ,其中的 path 缺少了 account.RootFolder

应该返回形如 https://pan.example.com/d/ali/live/day1/2351.mp4,而实际返回了 https://pan.example.com/d/day1/2351.mp4,缺少了所挂载的根目录路径,其中 https://pan.example.com 为被挂载的 Alist 的地址

可参考修改方案如下(未调试):

func (driver Alist) Link(args base.Args, account *model.Account) (*base.Link, error) {
	path := args.Path
	path = utils.ParsePath(path)
	path = utils.ParsePath(account.RootFolder) + path
	name := utils.Base(path)
	flag := "d"
	if utils.GetFileType(filepath.Ext(path)) == conf.TEXT {
		flag = "p"
	}
	link := base.Link{}
	link.Url = fmt.Sprintf("%s/%s%s?sign=%s", account.SiteUrl, flag, path, utils.SignWithToken(name, conf.Token))
	return &link, nil
}

感谢 @julydate 与我一起抓到的虫~

Reproduction / 复现链接

不想暴露自己的网盘地址就不想放了

Logs / 日志

No response

@Raobee Raobee added the bug Something isn't working label Jul 14, 2022
@welcome
Copy link

welcome bot commented Jul 14, 2022

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

@xhofe xhofe moved this to Todo in Alist V3 Jul 15, 2022
@xhofe xhofe added this to Alist V3 Jul 15, 2022
@xhofe xhofe closed this as completed Jul 21, 2022
Repository owner moved this from 🆕 Todo to ✅ Done in Alist V3 Jul 21, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants