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

为啥文件上传路径和实际访问直链地址不一致?直链地址需要加/d、/p前缀 #7166

Closed
2 of 4 tasks
mark8s opened this issue Sep 11, 2024 · 8 comments
Closed
2 of 4 tasks
Labels
bug Something isn't working

Comments

@mark8s
Copy link

mark8s commented Sep 11, 2024

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.36.0

Driver used / 使用的存储驱动

minio

Describe the bug / 问题描述

我有些困惑,就是为啥文件上传的路径和实际访问的地址不一致,实际访问的prefix path多/d或者/p。

比如我上传一个文件到一个路径如:/minio/bug/f3500a0d-56e0-4dcc-ab0d-534895bd10c0.jpg

我关掉了sign,我想直链访问。我理想的访问路径就是 /minio/bug/f3500a0d-56e0-4dcc-ab0d-534895bd10c0.jpg,也就是说只要我用 alist服务地址+ /minio/bug/f3500a0d-56e0-4dcc-ab0d-534895bd10c0.jpg,我就应该能直接访问到我的图片才对。但是实际中,我需要用 alist服务地址+ /d +/minio/bug/f3500a0d-56e0-4dcc-ab0d-534895bd10c0.jpg 才能访问。这是为啥?

前端的实现貌似如下:
1726041750547_63D7DEE1-D4D9-43f5-BD49-449A7B3DAB30

为什么需要这么做呢?整个实现的原理是咋样的啊?有没有人知道?

Reproduction / 复现链接

xx

Config / 配置

xx

Logs / 日志

No response

@mark8s mark8s added the bug Something isn't working label Sep 11, 2024
@mark8s mark8s changed the title 为啥文件上传的路径和实际访问的直链地址不一致,实际访问的prefix path多/d或者/p 为啥文件上传路径和实际访问直链地址不一致?直链地址需要加/d、/p前缀 Sep 11, 2024
@Simonzhang8
Copy link

你不加/d相当于访问Alist的前端页面
比如https://al.nn.ci/alist.png 访问的就是Alist页面,并在页面中预览相应路径的图片
image
https://al.nn.ci/d/alist.png 才是直接打开的图片文件(当然本案例中需要加sign)
image

@yyxytop
Copy link

yyxytop commented Sep 11, 2024

@Simonzhang8
你这是怎么做到的,我的加了d直接就下载了 你这是预览

@hshpy
Copy link

hshpy commented Sep 11, 2024

/p是proxy下载

@Simonzhang8
Copy link

@Simonzhang8 你这是怎么做到的,我的加了d直接就下载了 你这是预览

@Simonzhang8 你这是怎么做到的,我的加了d直接就下载了 你这是预览

这个取决于原链接的设置,原链接预览就是预览,原链接直接下载就是下载,我也不太清楚怎么调整这个😂

@ThinkerWen
Copy link

@Simonzhang8 你这是怎么做到的,我的加了d直接就下载了 你这是预览

响应体有content-disposition: attachment,会直接下载图片,他这个好像调用系统的图片查看器展示图片,如果设置成content-disposition: inline就可以在浏览器页面内嵌展示了

@Simonzhang8
Copy link

响应体有content-disposition: attachment,会直接下载图片,他这个好像调用系统的图片查看器展示图片,如果设置成content-disposition: inline就可以在浏览器页面内嵌展示了

应该是这样,那就需要直接修改响应体了,Alist这边默认就是保留源链接的响应体,原本是attachment就下载,原本是inline就内嵌

@mark8s
Copy link
Author

mark8s commented Sep 12, 2024

@Simonzhang8 @ThinkerWen @hshpy @yyxytop 好的谢谢。 大家能再帮忙看个问题吗? #7161

@yyxytop
Copy link

yyxytop commented Sep 12, 2024

响应体有content-disposition: attachment,会直接下载图片,他这个好像调用系统的图片查看器展示图片,如果设置成content-disposition: inline就可以在浏览器页面内嵌展示了

应该是这样,那就需要直接修改响应体了,Alist这边默认就是保留源链接的响应体,原本是attachment就下载,原本是inline就内嵌

好的想到了,可以预览的好像叫流媒体?是流不是文件?,一般对象存储可以预览好像就是这样,alist的可以直接在文章中引用展示图片,但是点开链接就是下载,对象存储就不是。哈哈 没啥问题了,影响不大 @Simonzhang8

@mark8s mark8s closed this as completed Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants