Make WordPress Core


Ignore:
Timestamp:
02/07/2023 11:45:18 PM (2 years ago)
Author:
danielbachhuber
Message:

REST API: Support non-Latin characters in template route regex.

Non-Latin characters are URL-encoded (e.g. %cf%84%ce%b5%cf%83%cf%84). Matching % in the route ensures templates with non-Latin titles can be properly saved.

Props antonyagrios, mburridge.
Fixes #57329.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php

    r54817 r55294  
    106106                '([^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)',
    107107                // Matches the template name.
    108                 '[\/\w-]+'
     108                '[\/\w%-]+'
    109109            ),
    110110            array(
     
    835835                    'required'    => true,
    836836                    'minLength'   => 1,
    837                     'pattern'     => '[a-zA-Z0-9_\-]+',
     837                    'pattern'     => '[a-zA-Z0-9_\%-]+',
    838838                ),
    839839                'theme'          => array(
Note: See TracChangeset for help on using the changeset viewer.