You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
88250
changed the title
Support directly access 'data/storage/*' contents via URL link
Support directly access 'data/public/*' contents via URL link
Jun 22, 2023
88250
changed the title
Support directly access 'data/public/*' contents via URL link
Support directly access data/public/* contents via URL link
Jun 22, 2023
In what scenarios do you need this feature?
当开发插件时,需要能通过URL直接访问插件数据下缓存的图片文件。经测试,把图片存在plugin文件夹、widgets文件夹,都可以通过URL相对路径链接直接访问,但是存在storage文件夹下,会报404错误
url('/plugin/xxxx/image.png')
(成功访问)url('/widgets/xxxx/image.png')
(成功访问)url('/storage/xxxx/image.png')
(404报错)怀疑是没有挂载到数据下造成的 (对应代码),或者有别的安全角度的考虑在这里?(那如果只挂载
/storage/petal
呢?)Describe the optimal solution
其实可以通过思源的readfile API来读取图片的数据然后转成base64字符串的方式实现访问storage目录下的图片,但是感觉绕了一大圈,不如支持挂载storage来的直观
之前也尝试过用Plugin.saveData和Plugin.loadData来读写图片,但是好像只支持标准的json格式,读图片会遇到编码问题
或者提供一个让插件挂载自身/storage/petal/xxxx/文件目录的API?如
Plugin.serveStorage()
这种,方便通过URL直接访问缓存的文件Describe the candidate solution
No response
Other information
No response
The text was updated successfully, but these errors were encountered: