Escape the Binary field hint in the legacy content editor so an apostrophe doesn't break the field
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 79/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java, javascript
- 领域
- frontend
调研方向
从dotCMS/src/main/webapp/html/portlet/ext/contentlet/field/edit_field.jsp中约第839行的hint赋值处开始,并与约第246行的字段变量 JSON 转义进行比较。检查此内联脚本中的值(包括字段值)是如何转义的,然后使用包含引号、反斜杠和换行符的 Binary 字段提示复现问题。完成标准是字段可以加载,输入的提示能正确显示,并且这些字符不再破坏脚本。
由索引模型根据 Issue 内容生成。
描述
Problem Statement
In the legacy (Dojo/JSP) content editor, a Binary field whose Hint contains an apostrophe (e.g. a user's computer) never finishes loading: the field area shows a spinner forever and no file can be uploaded.
The hint is written unescaped into a single-quoted JavaScript string in dotCMS/src/main/webapp/html/portlet/ext/contentlet/field/edit_field.jsp (~line 839):
hint: '<%=hint%>',
The apostrophe ends the string early, the inline script fails with Uncaught SyntaxError: Unexpected identifier 's', and the code that replaces the spinner with the dotcms-binary-field component never runs. A line break or backslash in the hint breaks it the same way. The field-variables JSON on line ~246 is already escaped with StringEscapeUtils.escapeJavaScript; the hint here is not.
Workaround: remove apostrophes and line breaks from the Binary field's hint.
Steps to Reproduce
- Create a content type with a Binary field.
- Set the Binary field's Hint to:
Only include if a copy on a user's computer is useful. - Open a new or existing contentlet of that type in the legacy content editor.
- Observe the Binary field spinner never resolves, and the browser console shows
Uncaught SyntaxError: Unexpected identifier 's'.
Acceptance Criteria
- A Binary field hint containing an apostrophe, double quote, backslash, or line break renders correctly and the field loads.
- The hint text displays as entered.
- Other values written into that inline script (e.g. the field value) are escaped for JavaScript the same way.
dotCMS Version
Current Evergreen release; present in main.
Severity
Low - Minor issue or cosmetic
Links
- 主要语言
- Java
- 星标
- 972
- 派生
- 493
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 237
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dotCMS/core 的其他 Issue
-
OKR : Customer Support Team : Maintenance Type : Defect
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
Opening content from Content Search replaces the "Search" breadcrumb in the new Edit Content screen未关闭dotCMS: New Edit Contentlet OKR : Customer Support Team : Falcon Type : Defect
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
dotCMS : Permissions OKR : Customer Support Team : Maintenance Type : Defect
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 2 天内回复
-
OKR : Customer Support Team : Maintenance Type : Defect
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 2 天内回复
-
dotCMS : UVE OKR : Customer Support Team : Maintenance Type : Defect
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
it-at-m/Wahllokalsystem#3846 ·
维护者通常 2 天内回复
-
Area/Connector module/solace Priority/Low Type/Bug
难度 2/5 1-3 小时 新手友好度 77/100
ballerina-platform/ballerina-library#9849 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
Vakore/ZappierGames#327 ·
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
Radix number block generates NaN after switching a negative or decimal number to binary, octal or hex可能已有人在做 @matthewalberto 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 64/100
mit-cml/appinventor-sources#4246 · 1 条评论 ·
维护者通常 1 天内回复