Skip to content

fix: Changes made in #2574 isn't published #2597

@sohhaofeng1989

Description

@sohhaofeng1989

Description

While testing @IsBase64({ urlSafe: true }), it was noticed that the { urlSafe: true } option still gets swallowed despite the updates made in fix: pass arguments correctly to isBase64 #2574 . As a sanity check, I have also verified in my package.json & node_modules that class-validator is up-to-date at ^0.14.1

Upon further investigation, it was noted that the changes made in fix: pass arguments correctly to isBase64 #2574 has yet to be published on npm registry@0.14.1:

/class-validator/cjs/decorator/string/IsBase64.js

function IsBase64(options, validationOptions) {
    return (0, ValidateBy_1.ValidateBy)({
        name: exports.IS_BASE64,
        constraints: [options],
        validator: {
            validate: (value, args) => isBase64(value),
            defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be base64 encoded', validationOptions),
        },
    }, validationOptions);
}

Expected behavior

This is in contrast to the ValidatorJS.IsEmailOptions that had been applied to @IsEmail (and got published)

/class-validator/cjs/decorator/string/IsEmail.js

function IsEmail(options, validationOptions) {
    return (0, ValidateBy_1.ValidateBy)({
        name: exports.IS_EMAIL,
        constraints: [options],
        validator: {
            validate: (value, args) => isEmail(value, args === null || args === void 0 ? void 0 : args.constraints[0]),
            defaultMessage: (0, ValidateBy_1.buildMessage)(eachPrefix => eachPrefix + '$property must be an email', validationOptions),
        },
    }, validationOptions);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions