Skip to content

Category name with special characters brakes in url rewrites category tree #13296

@galanis-a

Description

@galanis-a

Preconditions

  1. Magento 2.2.0
  2. PHP 7.0
  3. MySQL 5.6.35
  4. Windows Docker

Steps to reproduce

  1. Create a category with quotes (") in its name. ex Test "Category"
  2. Try to create a url rewrite (Go to Admin>>Marketing>>URL Rewrites>>Add URL Rewrite)
  3. Select For Category in the dropdown

Expected result

  1. The full category tree should load and be able to select the category you want to create URL Rewrite for.

Actual result

  1. The category tree doesn't load at all
    image-2018-01-16-17-46-06-555
  2. In the browser console throws this error
    url-rewrite-error

This is due to the category tree json not escaped in the Magento/UrlRewrite/view/adminhtml/templates/categories.phtml.
I overrided the file and changes it to this

`<?php
/**

  • Copyright © Magento, Inc. All rights reserved.
  • See COPYING.txt for license details.
    */

// @codingStandardsIgnoreFile

/** @var \Magento\UrlRewrite\Block\Catalog\Category\Tree $block */
?>

escapeHtml(__('Select Category')) ?>
getRoot()): ?>
[ 'data' => $block->getTreeArray(), 'url' => $block->escapeUrl($block->getLoadTreeUrl()), ], ]),ENT_QUOTES, 'UTF-8'); ?>' class="jstree-default">
`

it works but the special characters in category names are now shown escaped.
Ex. double quotes are #&quot and this is a problem.

I didn't test for pruducts or CMS pages.

Metadata

Metadata

Assignees

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions