Skip to content

Commit

Permalink
Fix [Feature Store] Add 'space' validation into the artifact name par…
Browse files Browse the repository at this point in the history
…t of the path (#2565)
  • Loading branch information
Taras-Hlukhovetskyi authored Jul 3, 2024
1 parent 5c6e182 commit e7b5aa6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/common/TargetPath/targetPath.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const targetPathRegex =
const httpTargetPathRegex =
/^(http|https):(\/\/\/|\/\/)(?!.*:\/\/)([\w\-._~:/?#[\]%@!$&'()*+,;=]+)$/i
const mlrunTargetPathRegex =
/^(artifacts|feature-vectors|datasets|models)\/(.+?)\/(.+?)(#(.+?))?(:(.+?))?(@(.+))?$/
/^(artifacts|feature-vectors|datasets|models)\/(\S+?)\/(\S+?)(#(\S+?))?(:(\S+?))?(@(\S+))?$/

export const pathPlaceholders = {
[MLRUN_STORAGE_INPUT_PATH_SCHEME]: 'artifacts/my-project/my-artifact:my-tag',
Expand Down
6 changes: 3 additions & 3 deletions src/components/FeatureSetsPanel/UrlPath.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ export const projectItemsPathTypes = [
export const isUrlInputValid = (pathInputType, pathInputValue, dataSourceKind) => {
const regExp =
dataSourceKind === CSV
? /^(artifacts|datasets|models)\/(.+?)\/(.+?)(#(.+?))?(:(.+?))?(@(.+))?(?<!\/)$/
: /^(artifacts|datasets|models)\/(.+?)\/(.+?)(#(.+?))?(:(.+?))?(@(.+))?$/
? /^(artifacts|datasets|models)\/(\S+?)\/(\S+?)(#(\S+?))?(:(\S+?))?(@(\S+))?(?<!\/)$/
: /^(artifacts|datasets|models)\/(\S+?)\/(\S+?)(#(\S+?))?(:(\S+?))?(@(\S+))?$/
const valueIsNotEmpty = pathInputValue?.trim().length > 0
const defaultValidation = valueIsNotEmpty && /.*?\/(.*?)/.test(pathInputValue)
const defaultValidation = valueIsNotEmpty && /^[^\s]*\/[^\s]*$/.test(pathInputValue)

switch (pathInputType) {
case MLRUN_STORAGE_INPUT_PATH_SCHEME:
Expand Down

0 comments on commit e7b5aa6

Please sign in to comment.