-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
图片上传问题 #2945
Comments
没能复现,我这边甚至无法粘贴。你使用的操作系统是? /triage needs-information |
macos monterey |
本地上传也有类似的问题: 上传的表单详情如下: -----------------------------330239117212975919733627836481
Content-Disposition: form-data; name="policyName"
default-policy
-----------------------------330239117212975919733627836481
Content-Disposition: form-data; name="groupName"
-----------------------------330239117212975919733627836481
Content-Disposition: form-data; name="file"; filename="image.png"
Content-Type: image/png |
本地存储的已经在#3042 中修复了 这个问题可以通过先headobject查看是否存在同名文件,若同名可与本地存储一样报同名文件已存在错误 |
Hi @longjuan , IMO,建议暂时和本地上传的逻辑保持一致,通过 S3 上传的图片判断一下 object name 是否重复,如果重复则友好提示用户即可。 |
好的 |
Hi @longjuan ,这个问题还需要在 console 端的上传组件还需要优化一下,对于直接粘贴的图片,需要用 |
/kind bug |
好的,我研究一下 |
OK,我会抽时间研究一下。 /assign |
Fixes halo-dev/halo#2945 ```release-note Add file check with the same name when uploading ``` 我这里使用了ConcurrentHashMap避免**同时**上传两个同名文件导致文件覆盖问题,在本地存储策略中是由操作系统保证的 不知道这样是不是一个好方法 S3AsyncClient中没有`doesObjectExist`类似的方法,官方的文档也让用`headObject`捕获异常的办法来判断文件是否存在,详见https://github.com/aws/aws-sdk-java-v2/blob/master/docs/LaunchChangelog.md 中搜索`doesObjectExist`
可能还是得在后端兼容同名的附件上传。无论是本地上传还是 OSS 上传。 |
什么策略,全部都要重命名还是重复了才重命名,是拼接时间戳吗? |
项目同样遇到这样的问题,这边觉得可以加上时间戳,毕竟是复制上来的附件一般只在本篇文章使用。复用率很低 |
已经在 #3305 中支持自动重命名。 /close |
@ruibaby: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
可以麻烦问一下,本地上传方式,上传的图片去哪里呢? |
是什么版本出现了此问题?
v2.0.1
使用的什么数据库?
PostgreSQL
使用的哪种方式部署?
Docker
在线站点地址
No response
发生了什么?
使用阿里云oss插件,通过粘贴板先后粘贴三张图片上传,实际结果只有一张图片被上传了,可能原因是三张图片默认粘贴到系统都叫image.png
![image](https://user-images.githubusercontent.com/16661764/207512189-4ed8151a-84d9-4199-ac0b-3d2763f57db7.png)
![image](https://user-images.githubusercontent.com/16661764/207512397-a4d108c3-57cd-441f-bec9-af6659d6e72a.png)
![image](https://user-images.githubusercontent.com/16661764/207512433-458d7086-fe1d-45a3-bf36-d849df6778b6.png)
相关日志输出
No response
附加信息
No response
The text was updated successfully, but these errors were encountered: