sy-records / sync-qcloud-cos

💾 使用腾讯云对象存储服务COS作为附件存储空间的WordPress插件。https://wordpress.org/plugins/sync-qcloud-cos/
https://qq52o.me/2518.html
Apache License 2.0
145 stars 19 forks source link

MIME Bug #70

Closed djerryz closed 1 month ago

djerryz commented 1 month ago

感谢开源这个优秀的项目, 最近文件上传遇到下述问题:

image

Warning: Undefined array key "jpg|jpeg|jpe" in /var/www/html/wp-content/plugins/sync-qcloud-cos/sync-qcloud-cos.php on line 360 Warning: Undefined array key "gif" in /var/www/html/wp-content/plugins/sync-qcloud-cos/sync-qcloud-cos.php on line 361 Warning: Undefined array key "bmp" in /var/www/html/wp-content/plugins/sync-qcloud-cos/sync-qcloud-cos.php on line 363 Warning: Undefined array key "tiff|tif" in /var/www/html/wp-content/plugins/sync-qcloud-cos/sync-qcloud-cos.php on line 364 Warning: Undefined array key "webp" in /var/www/html/wp-content/plugins/sync-qcloud-cos/sync-qcloud-cos.php on line 365 Warning: Undefined array key "ico" in /var/www/html/wp-content/plugins/sync-qcloud-cos/sync-qcloud-cos.php on line 366 3401

我解决了这个问题: modify$mime_types = get_allowed_mime_types(); to $mime_types = wp_get_mime_types();

sy-records commented 1 month ago

get_allowed_mime_types 也是调用的 wp_get_mime_types,可能是你当前登录用户权限不够被过滤了?

https://developer.wordpress.org/reference/functions/get_allowed_mime_types/ https://developer.wordpress.org/reference/functions/wp_get_mime_types/

不过用wp_get_mime_types也行

djerryz commented 1 month ago

挺奇怪的,之前没有出现过这个情况,我使用的是管理员权限登录的,怀疑是做了环境迁移带来的bug