Skip to content

When 'null' is in an array of tags, signature breaks #581

@rhwinter

Description

@rhwinter

Describe the bug in a sentence or two.

When doing

tags = ['test', null];
await cloudinary.v2.uploader.replace_tag(tags, public_id, { type: "private" });

I get a "Invalid Signature" 401 error.

Issue Type (Can be multiple)

[ ] Build - Can’t install or import the SDK
[ ] Babel - Babel errors or cross browser issues
[ ] Performance - Performance issues
[X] Behaviour - Functions aren’t working as expected (Such as generate URL)
[ ] Documentation - Inconsistency between the docs and behaviour
[ ] Incorrect Types - For typescript users who are having problems with our d.ts files
[ ] Other (Specify)

Steps to reproduce

import cloudinary from 'cloudinary';
import configuration from 'somewhere';

cloudinary.config({
    ...configuration.secrets.cloudinary,
    secure: true
});

const public_id = 'some public ID here',
tags = ['test', null];
await cloudinary.v2.uploader.replace_tag(tags, public_id, { type: "private" });

Versions and Libraries (fill in the version numbers)

Cloudinary_NPM SDK version 1.33.0
Node - 19.3.0
NPM - 9.2.0

Further comments

Changing line 386 in /lib/uploader.js to

params.tag = tag.filter(t => t);

Fixes the issue, but I think the real problem lies in how clear_blank() (in /lib/utils/index.js) is implemented, but I didn't have time to dig too much deeper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions