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

feat: Support encoding uri #3027

Merged
merged 9 commits into from
Apr 23, 2024
Prev Previous commit
Next Next commit
fix: Pre-encode value before other cases
  • Loading branch information
HYOSITIVE committed Mar 30, 2024
commit 19f1f309505971cf97befd14ab13f04d0c675a99
8 changes: 4 additions & 4 deletions lib/types/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,10 @@ module.exports = Any.extend({
return helpers.error('string.uri');
}

if (helpers.prefs.convert && options.encodeUri) {
value = encodeURI(value);
HYOSITIVE marked this conversation as resolved.
Show resolved Hide resolved
}

const match = regex.exec(value);
if (match) {
const matched = match[1] || match[2];
Expand All @@ -678,10 +682,6 @@ module.exports = Any.extend({
return value;
}

if (helpers.prefs.convert && options.encodeUri) {
return encodeURI(value);
}

if (options.relativeOnly) {
return helpers.error('string.uriRelativeOnly');
}
Expand Down
Loading