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

Options misssing for the listFileVersions function #91

Open
michel-smarticket opened this issue Jan 14, 2020 · 1 comment
Open

Options misssing for the listFileVersions function #91

michel-smarticket opened this issue Jan 14, 2020 · 1 comment

Comments

@michel-smarticket
Copy link

Hello,

I've noticed the prefix and delimiter options are missing from the listFileVersions function.
This raises an issue when trying to filter specific files from backblaze.

Proposed change:

exports.listFileVersions = function(b2, args) {
    const bucketId = args.bucketId;
    const startFileName = args.startFileName;
    const startFileId = args.startFileId;
    const maxFileCount = args.maxFileCount;
    const prefix = args.prefix;
    const delimiter = args.delimiter;

    const options = {
        url: endpoints(b2).listFileVersionsUrl,
        method: 'POST',
        headers: utils.getAuthHeaderObjectWithToken(b2),
        data: {
            bucketId: bucketId,
            startFileName: startFileName || '',
            prefix: prefix || '',
            delimiter: delimiter || null,
            startFileId: startFileId,
            maxFileCount: maxFileCount || 100
        }
    };

    // merge order matters here: later objects override earlier objects
    return request.sendRequest(_.merge({},
        _.get(args, 'axios', {}),
        options,
        _.get(args, 'axiosOverride', {})
    ));
};
@RayRemnant
Copy link

I think this is pretty important, I've done the same changes in order to use the listFileVersions as intended.
Without the prefix and delimiter parameters you need additional work to select the versions of a single file.

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

No branches or pull requests

2 participants