WYSIWYG link tool inserts the first-version inode for dotAssets and images (/dA/<inode>), so links show an outdated version after the asset is edited
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java, javascript
- Lĩnh vực
- backend, developer-experience
Hướng nghiên cứu
Bắt đầu tại dotCMS/src/main/webapp/html/portlet/ext/contentlet/field/edit_field_js.jsp và đọc addFileCallback, hàm tạo liên kết cho dotAssets và Images từ file.path. So sánh hành vi đó với URL của nút hình ảnh dựa trên identifier, sau đó kiểm tra luồng liên kết WYSIWYG cũ. Hoàn tất khi hộp thoại duyệt chèn /dA/<identifier>/<name> cho dotAssets và Images, đồng thời các liên kết File Asset và trang hiện có vẫn hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem Statement
In the legacy WYSIWYG field (the legacy edit-contentlet screen), the Insert link dialog's file browser builds the href for dotAssets and images as /dA/<inode>/<name>. This covers every content type of base type dotAsset: the DotAsset content type and the Image content type (an Image asset is a dotAsset). In addFileCallback (dotCMS/src/main/webapp/html/portlet/ext/contentlet/field/edit_field_js.jsp), the id is taken from file.path.split(".")[1], and a dotAsset's (or Image's) path/url field keeps the inode of its first version (/content.<first inode>) for the lifetime of the asset. The link is therefore pinned to the first version instead of to the asset's identifier. Images stored as File Assets are different: they get the Site Browser path (see Out of scope).
Impact
- After any new version of the dotAsset or Image is saved (a new file, or even a metadata-only save), the link keeps resolving to the first version, so authors and visitors see an outdated file or image. If the asset was edited before it was inserted, the link is outdated from the start.
- Depending on permissions, a non-live version may instead redirect to login or return 404 (
BinaryExporterServletserves live versions only to users without read access). - The image button in the same editor inserts
/dA/<shortyId>/<name>?language_id=…(identifier-based), which always shows the latest version. The docs say dotAssets are accessed by their identifier (Image is a dotAsset type), and describe the inode form as the version at the time the link is inserted; the link tool uses neither (it uses the first version). WYSIWYG_IMAGE_URL_PATTERNdoes not influence the link tool (tested with the default pattern and with{path}{name};addFileCallbacknever reads the property), so there is no configuration workaround. Interim workaround: type/dA/<short identifier>/<file name>in the URL field.- Reported by a customer whose authors rely on the Link tool (hundreds of authors; an inconvenience, not blocking). Not browser-specific (JavaScript in the legacy JSP).
History: the dotAsset branch was added by commit 5b26570851 (Aug 2020, fix for #19041, a JavaScript error when adding a link; first in 5.3.7).
Related: File Assets (same tool, different behavior; a product decision, not part of this defect)
For File Assets, including images stored as File Assets, the Link tool inserts the Site Browser path (file.path, for example /files/report.pdf). Unlike the dotAsset case, this is not new:
- Before 2015 the file browser inserted
/contentAsset/raw-data/<identifier>/fileAsset, which was reported as an invalid URL. #7729 changed it to the path, and #8229 fixed follow-up cross-site link problems. - From 2015 to 2020 every file got
path + name. The 2020 change (5b26570851) kept the path for File Assets and added the/dA/branch for dotAssets only. - At no point did the Link tool insert a
/dA/URL for a File Asset.
The docs say File Assets can be reached by path or by identifier. The result is an inconsistency inside the same editor: a path link breaks when the file is renamed or moved, while the image button inserts /dA/<shortyId>/<name>?language_id=… for the same File Asset. The customer who reported this expects the Link tool to behave like the image button. Product to decide whether the Link tool should insert /dA/<identifier> for File Assets too.
Steps to Reproduce
Video screencast: https://drive.google.com/file/d/1J9QHbskwX748kPmhjhRWpYU2PtbEclBb/view?usp=drive_link (dotCMS internal)
Or detailed steps:
- Use a content type with a WYSIWYG field on the legacy editor (content type metadata
CONTENT_EDITOR2_ENABLED=false). - Create and publish a dotAsset (content type
DotAsset), for examplered.png. - In the WYSIWYG field, select some text, click Link, click the browse button next to the URL box and pick the dotAsset. Switch the field to Code view:
href="/dA/<inode>/red.png". - Save the content. Replace the dotAsset's file with
blue.png(new version) and publish it. - Open the saved link: it still serves
red.png(the first version).
Repeat with an asset of the Image content type (for example photo.png): same result, href="/dA/<inode>/photo.png", and the saved link still shows the first version after the image is replaced.
Variant: give the dotAsset or Image two versions before inserting it. The inserted id is still the first version's inode, not the current one.
Tested on 26.10.13-01 (Docker image) through the UI and the API for both the DotAsset and Image content types, including assets placed in folders. Also seen on a customer's dev environment with an Image-type asset.
Acceptance Criteria
- Inserting a dotAsset or an
Imageasset with the Link dialog's file browser writes/dA/<identifier>/<name>(same identifier form as the image button), not an inode. - After a new version of the dotAsset or Image is saved and published, the saved link shows the new version.
- A dotAsset or Image that already had several versions before insertion also produces an identifier-based link.
- Works for dotAssets and Images in folders, and for any content type of base type dotAsset.
- Existing File Asset and page link behavior is unchanged (unless product decides otherwise, see Related: File Assets).
dotCMS Version
26.10.13-01 (dotCMS Cloud dev environment and local Docker image). The dotAsset branch dates from 5.3.7, so older versions are affected too.
Severity
Medium - Some functionality impacted
Links
- Ngôn ngữ chính
- Java
- Star
- 972
- Fork
- 493
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 237
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotCMS/core
-
Opening content from Content Search replaces the "Search" breadcrumb in the new Edit Content screenĐang mởdotCMS: New Edit Contentlet OKR : Customer Support Team : Falcon Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Escape the Binary field hint in the legacy content editor so an apostrophe doesn't break the fieldĐang mởOKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 2 ngày
-
dotCMS : Permissions OKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày
-
OKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
-
dotCMS : UVE OKR : Customer Support Team : Maintenance Type : Defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
dotCMS/core#38260 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
it-at-m/Wahllokalsystem#3846 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Area/Connector module/solace Priority/Low Type/Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
ballerina-platform/ballerina-library#9849 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
Vakore/ZappierGames#327 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Radix number block generates NaN after switching a negative or decimal number to binary, octal or hexCó thể đã có người làm @matthewalberto đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
mit-cml/appinventor-sources#4246 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày