-
Notifications
You must be signed in to change notification settings - Fork 51
FOUR-29250 End Event – External URL with Mustache Support #1963
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
02bd1f0
FOUR-29250 End Event – External URL with Mustache/FEEL Support
gproly a900ff2
FOUR-29250 Add InspectorConfigViewer: collapsible card in modeler ins…
gproly 1b5ac66
FOUR-29250 Remove InspectorConfigViewer and update ElementDestination.
gproly 87098c8
FOUR-29250 Require URL when External URL is selected in ElementDestin…
gproly c02f982
FOUR-29250 ElementDestination: improve URL validation
gproly fc7402d
FOUR-29250 Fix ElementDestination URL validation message: keep Mustac…
gproly 80848dd
FOUR-29250 Refactor URL validation in ElementDestination and TaskDest…
gproly c3d28c9
FOUR-29250 Add isValidElementDestinationURL utility for validating El…
gproly 5072325
FOUR-29250 Update Mustache placeholder regex in elementDestinationUrl…
gproly 8161714
FOUR-29250 Add unit tests for elementDestinationUrl validation
gproly 5cced67
FOUR-29250 Export hasValidMustacheOnly and add tests for full coverage.
gproly cbdf52b
FOUR-29250 Reject empty mustache {{}} in URL validation and add tests
gproly 3de0274
FOUR-29250 Add tests for empty mustache validation and fix indent in …
gproly cb9d8d7
FOUR-29250 Improve elementDestinationUrl unit tests: add file comment…
gproly acc032f
FOUR-29250 Strict mustache URL validation and tests
gproly c1374e6
FOUR-29250 Add tests for mustache URL validation (stray braces, inval…
gproly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /** | ||
| * Valid Mustache placeholder: {{ variable }}. | ||
| * Variable: one or more non-whitespace characters (no spaces inside the name). Rejects {{}}, {{ }}, {{var2 var2}}. | ||
| */ | ||
| const MUSTACHE_PLACEHOLDER = /{{\s*\S+\s*}}/; | ||
|
cursor[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| /** | ||
| * Returns true if the string has only valid Mustache definitions (one or more) and no stray {{ or }}. | ||
| * Valid: {{var}}, {{ APP_URL }}, https://host/{{path}}, {{a}}{{b}}. Invalid: {{}}, {{ }}, {{unclosed, }}solo. | ||
| * @param {string} str - Non-empty trimmed string. | ||
| * @returns {boolean} | ||
| */ | ||
| function hasValidMustacheOnly(str) { | ||
| if (!str.includes('{{')) { | ||
| return false; | ||
| } | ||
| const globalRegex = new RegExp(MUSTACHE_PLACEHOLDER.source, 'g'); | ||
| const withoutPlaceholders = str.replace(globalRegex, ''); | ||
| const hasStrayBraces = withoutPlaceholders.includes('{{') || withoutPlaceholders.includes('}}'); | ||
| if (hasStrayBraces) { | ||
| return false; | ||
| } | ||
| // No stray braces and string contained {{ → at least one valid placeholder was matched. | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Validates Element Destination / Conditional Redirect URL field. | ||
| * 1. Must be a non-empty string. | ||
| * 2. If it contains {{: must be valid Mustache (one or more placeholders like {{var}}, no stray braces). Invalid Mustache → false (same as invalid URL). | ||
| * 3. If it does not contain {{: must be a valid URL. | ||
| * | ||
| * @param {string} value - Value to validate (URL or Mustache template). | ||
| * @returns {boolean} | ||
| */ | ||
| export function isValidElementDestinationURL(value) { | ||
| if (typeof value !== 'string') { | ||
| return false; | ||
| } | ||
| const trimmed = value.trim(); | ||
| if (trimmed.length === 0) { | ||
| return false; | ||
| } | ||
|
|
||
| if (trimmed.includes('{{')) { | ||
| return hasValidMustacheOnly(trimmed); | ||
| } | ||
|
|
||
|
cursor[bot] marked this conversation as resolved.
|
||
| try { | ||
| new URL(trimmed); | ||
| return true; | ||
| } catch { | ||
| return false; | ||
| } | ||
|
gproly marked this conversation as resolved.
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.