plugin-update-checker icon indicating copy to clipboard operation
plugin-update-checker copied to clipboard

Cannot use slashes in branch name

Open dagmanolis opened this issue 4 years ago • 6 comments

Hello, I am using bitbucket repo. If I use $myUpdateChecker->setBranch("impl/default") it doesnt recognize the branch. This is cache from debug bar

Puc_v4p10_Plugin_Update Object
(
    [id] => 0
    [homepage] => https://domain/
    [upgrade_notice] => 
    [tested] => 
    [requires_php] => 
    [icons] => Array
        (
        )

    [filename] => plugin_name/plugin_name.php
    [slug] => plugin_slug
    [version] => 
    [download_url] => https://bitbucket.org/abc/xyz/get/impl/default.zip
    [translations] => Array
        (
        )

)

Anyone else have this problem?

dagmanolis avatar Jan 23 '21 15:01 dagmanolis

It looks like at least the download URL is pointing to the branch. Is that correct? In that case, is the problem that the rest of the update information is not populated (for example, the "version" property is empty)?

I would recommend installing the Debug Bar plugin. Then you can go to the "PUC (plugin-slug)" panel and click "Request Info", which should show any BitBucket API errors that the update checker encountered while trying to retrieve plugin details.

YahnisElsts avatar Jan 28 '21 14:01 YahnisElsts

Yes , the download link is correct. I don'use tags. I am using Debug Bar, but the request info button doesn't do anything

dagmanolis avatar Jan 28 '21 14:01 dagmanolis

I've done some testing of my own and it looks like the BitBucket API doesn't handle branch names with slashes very well. I created a branch with a slash in one of my test repositories. If I give the API the branch name as-is, I get a 404 Not Found error. If I URL-encode the name, I get a 401 Unauthorized error instead even though I'm using the same authentication details as before (unless it's a bug in my OAuth implementation?).

Perhaps it's better to use the commit hash if one is available. I've committed a patch that does this. Please give it a try.

YahnisElsts avatar Jan 28 '21 17:01 YahnisElsts

Thank you. I will try that in my next version.

dagmanolis avatar Jan 28 '21 18:01 dagmanolis

By the way, your plugin is awesome. Thank very much for sharing this.

dagmanolis avatar Jan 29 '21 12:01 dagmanolis

Sure, no problem. I'll leave the issue open for now. If the patch works for you, please leave a note here later.

YahnisElsts avatar Jan 29 '21 15:01 YahnisElsts