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

V3 get_file without 'alt' parameter is not fully implemented, here's the code #68

Open
Bitdreamr opened this issue Jan 31, 2024 · 0 comments

Comments

@Bitdreamr
Copy link

V3 get_file has an optional parameter 'alt', with only one valid value 'media', which is used to download the file content.

Omitting 'alt' is supposed to download file metadata, but what occurs is first a Perl warning
Use of uninitialized value in string eq at ... /Simple/V3.pm line 1286
Then immediately after that
Can't call method "decoded_content" on unblessed reference at ... Simple/V3.pm line 1291.

Current code in sub get_file:

    if ( $options->{'alt'} eq 'media' ) {
        $info->{'return_http_response'} = 1;
    }
    my $response = $self->_handle_api_method( $info, $options );
    return $response->decoded_content();

Proposed correction:

    if ( exists $options->{'alt'} and $options->{'alt'} eq 'media' ) {
        $info->{'return_http_response'} = 1;
    }
    my $response = $self->_handle_api_method( $info, $options );
    return $response->decoded_content() if exists $options->{'alt'};
    return $response;
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

1 participant