cloudinary / cloudinary/cloudinary_wordpress
Cloudinary asset being replaced
- Ngôn ngữ chính
- PHP
- Star
- 39
- Fork
- 36
- Merge trung bình
- 3 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 27
Mô tả
## Bug Description
PR [#1182](https://github.com/cloudinary/cloudinary_wordpress/pull/1182) causes Cloudinary assets to be overwritten when a new WordPress upload reuses the same filename.
WordPress only uniquifies filenames within the same month. If `test.jpg` is uploaded in April, Cloudinary creates public ID `test`. A second `test.jpg` in the same month is renamed to `test-1.jpg` (public ID `test-1`). A later upload of `test.jpg` in May keeps the original filename, so Cloudinary again gets public ID `test`.
After #1182, the plugin treats an existing public ID as a replacement and overwrites the original Cloudinary asset instead of creating a distinct one.
## Expected Behaviour
Uploading a new file with the same basename in a different month should not overwrite an existing Cloudinary asset. The plugin should generate a unique public ID (or otherwise treat it as a new asset), even when WordPress reuses the original filename.
## Steps to reproduce
1. Upload `test.jpg` to the WordPress Media Library in month A (e.g. April). Confirm it syncs to Cloudinary with public ID `test`.
2. Upload a different image also named `test.jpg` in the same month. Confirm WordPress renames it to `test-1.jpg` and Cloudinary uses public ID `test-1`.
3. Upload another different image named `test.jpg` in a later month (e.g. May). Confirm WordPress keeps the filename `test.jpg`.
4. Check the original Cloudinary asset with public ID `test`.
5. See that it has been overwritten by the May upload instead of remaining the April image.
## Screenshots
## Additional context
This is a regression from https://github.com/cloudinary/cloudinary_wordpress/pull/1182. The change detects an existing public ID and assumes a replacement, which is incorrect when WordPress reuses a filename across months.
- WordPress version:
- Plugin version:
- Gutenberg plugin version (if applicable):
- PHP version:
- Plugin settings:
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Start by reviewing PR #1182 and tracing the WordPress upload-to-Cloudinary sync path that handles an existing public ID. Reproduce the three-upload sequence from the issue, then verify that the April asset remains unchanged and the later upload receives a distinct identity.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100