Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:port name cant have consecutive hyphens #3976

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
ENVIRONMENT_INVALID_TIP: 'The key of an environment variable can contain only letters, numbers, underscores (_), hyphens (-), and periods (.), and must not start with a number.',
ENVIRONMENT_CANNOT_BE_EMPTY: 'Please set a key for the environment variable.',
// List > Create > Pod Settings > Port Settings
WORKLOAD_PORT_NAME_DESC: 'The port name can contain only lowercase letters, numbers and hyphens (-), and must start with a lowercase letter and end with a lowercase letter or number. The maximum length is 15 characters.',
WORKLOAD_PORT_NAME_DESC: 'The port name can contain only lowercase letters, numbers and hyphens (-), and must start with a lowercase letter and end with a lowercase letter or number, and cannot have consecutive hyphens. The maximum length is 15 characters.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The port name can contain only lowercase letters, numbers and hyphens (-), and must start with a lowercase letter and end with a lowercase letter or number. Avoid using consecutive hyphens. The maximum length is 15 characters.

// List > Create > Pod Settings > Update Strategy > Rolling Update Settings
MAX_EXTRA_PODS_DESC: 'Maximum number or percentage of extra pods allowed during the update process.',
MAX_EXTRA_PODS: 'Maximum Extra Pods',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = {
ENVIRONMENT_INVALID_TIP: '环境变量的键只能包含字母、数字、下划线(_)、连字符(-)和句点(.),并且不能以数字开头。',
ENVIRONMENT_CANNOT_BE_EMPTY: '请设置环境变量的键。',
// List > Create > Pod Settings > Port Settings
WORKLOAD_PORT_NAME_DESC: '名称只能包含小写字母、数字和连字符(-),必须以小写字母开头并以小写字母或数字结尾,最长 15 个字符。',
WORKLOAD_PORT_NAME_DESC: '名称只能包含小写字母、数字和连字符(-),必须以小写字母开头并以小写字母或数字结尾,不能有连续的分隔符,最长 15 个字符。',
// List > Create > Pod Settings > Update Strategy > Rolling Update Settings
MAX_EXTRA_PODS_DESC: '更新过程中允许的多余容器组副本的最大数量或百分比。',
MAX_EXTRA_PODS: '最大多余容器组数量',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ export const PATTERN_LABEL = /(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?/
export const PATTERN_TAG = /^[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$/
export const PATTERN_PASSWORD = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,64}$/
export const PATTERN_IMAGE = /^\S+$/
export const PATTERN_PORT_NAME = /^[a-z]([-a-z0-9]*[a-z0-9])?$/
export const PATTERN_PORT_NAME = /^[a-z](?:-?[a-z0-9]+)*$/

Check failure

Code scanning / CodeQL

Inefficient regular expression

This part of the regular expression may cause exponential backtracking on strings starting with 'a' and containing many repetitions of '0'.
export const PATTERN_COMPONENT_VERSION = /^[a-z0-9]+$/
export const PATTERN_PIPELINE_NAME = /[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/
export const PATTERN_HOST = /^(?=^.{3,255}$)[*a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/
Expand Down