Skip to content

Commit

Permalink
fix: Pre-encode value before other cases
Browse files Browse the repository at this point in the history
  • Loading branch information
HYOSITIVE committed Mar 30, 2024
1 parent aa16489 commit 19f1f30
Showing 1 changed file with 4 additions and 4 deletions.
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);
}

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

0 comments on commit 19f1f30

Please sign in to comment.