Skip to content

Support empty string for domainLockRedirectUrl (#1217) - #1470

Open
m2rtyaman wants to merge 2 commits into
javascript-obfuscator:masterfrom
m2rtyaman:fix/domain-lock-empty-redirect-url
Open

m2rtyaman wants to merge 2 commits into
javascript-obfuscator:masterfrom
m2rtyaman:fix/domain-lock-empty-redirect-url

Conversation

@m2rtyaman

Copy link
Copy Markdown

Fixes #1217

Currently domainLockRedirectUrl rejects empty strings during validation, and simply allowing '' in the existing template would assign document.location = '' (which reloads the current page instead of halting execution).

This PR allows passing '' to domainLockRedirectUrl and updates DomainLockTemplate at compile-time to throw an error instead of redirecting when no redirect URL is provided. It also skips the unnecessary hideString step when the URL is empty.

Added unit tests covering validation, normalizer rules, and template behavior.

m2rtyaman and others added 2 commits November 6, 2026 08:06
- Validate an empty string inside the URL check instead of `ValidateIf`, so it is still checked
  by `IsAllowedForObfuscationTargets` and rejected for the `node` target like any other value
- Mention the empty string behaviour in the `--domain-lock-redirect-url` CLI help
- Move the CHANGELOG entry out of the released v5.10.0 section into v5.11.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow domainLockRedirectUrl to accept empty string

2 participants