Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
zinigor authored and matticbot committed Dec 9, 2024
1 parent bd61dc5 commit 634f4cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.34.4-alpha] - unreleased

This is an alpha version! The changes listed here are not final.

### Fixed
- Form Block: fixed validation of URL input types to allow query strings.

## [0.34.3] - 2024-12-09
### Changed
- Updated package dependencies. [#40363]
Expand Down Expand Up @@ -733,6 +740,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a new jetpack/forms package [#28409]
- Added a public load_contact_form method for initializing the contact form module. [#28416]

[0.34.4-alpha]: https://github.com/automattic/jetpack-forms/compare/v0.34.3...v0.34.4-alpha
[0.34.3]: https://github.com/automattic/jetpack-forms/compare/v0.34.2...v0.34.3
[0.34.2]: https://github.com/automattic/jetpack-forms/compare/v0.34.1...v0.34.2
[0.34.1]: https://github.com/automattic/jetpack-forms/compare/v0.34.0...v0.34.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-forms",
"version": "0.34.3",
"version": "0.34.4-alpha",
"description": "Jetpack Forms",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/forms/#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/class-jetpack-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class Jetpack_Forms {

const PACKAGE_VERSION = '0.34.3';
const PACKAGE_VERSION = '0.34.4-alpha';

/**
* Load the contact form module.
Expand Down
4 changes: 3 additions & 1 deletion src/contact-form/class-contact-form-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public function validate() {
switch ( $field_type ) {
case 'url':
if ( ! is_string( $field_value ) || empty( $field_value ) || ! preg_match(
// Changes to this regex should be synced with the regex in the render_url_field method of this class as both validate the same input. Note that this regex is in PCRE format.
'%^(?:(?:https?|ftp)://)?(?:\S+(?::\S*)?@|\d{1,3}(?:\.\d{1,3}){3}|(?:(?:[a-z\d\x{00a1}-\x{ffff}]+-?)*[a-z\d\x{00a1}-\x{ffff}]+)(?:\.(?:[a-z\d\x{00a1}-\x{ffff}]+-?)*[a-z\d\x{00a1}-\x{ffff}]+)*(?:\.[a-z\x{00a1}-\x{ffff}]{2,6}))(?::\d+)?(?:[^\s]*)?$%iu',
$field_value
) ) {
Expand Down Expand Up @@ -590,7 +591,8 @@ public function render_url_field( $id, $label, $value, $class, $required, $requi
'title' => $custom_validation_message,
'oninvalid' => 'setCustomValidity("' . $custom_validation_message . '")',
'oninput' => 'setCustomValidity("")',
'pattern' => '(([:\/a-zA-Z0-9_\-]+)?(\.[a-zA-Z0-9_\-\/]+)+)',
// Changes to this regex should be synced with the regex in the URL validation of the validate method of this class as both validate the same input. Note that this regex is in ECMAScript (JS) format.
'pattern' => '(?:(?:[Hh][Tt][Tt][Pp][Ss]?|[Ff][Tt][Pp]):\/\/)?(?:\S+(?::\S*)?@|\d{1,3}(?:\.\d{1,3}){3}|(?:(?:[a-zA-Z\d\u00a1-\uffff]+-?)*[a-zA-Z\d\u00a1-\uffff]+)(?:\.(?:[a-zA-Z\d\u00a1-\uffff]+-?)*[a-zA-Z\d\u00a1-\uffff]+)*(?:\.[a-zA-Z\u00a1-\uffff]{2,6}))(?::\d+)?(?:[^\s]*)?',
'data-type-override' => 'url',
);

Expand Down

0 comments on commit 634f4cd

Please sign in to comment.