YahnisElsts/wp-update-server

WP is looking for plugin icon in the old locattion.

Opened this issue · 3 comments

WordPress Updates plugin icon URL points to
.../update-server/icons/plugin-slug-256x256.png
instead of
.../update-server/package-assests/icons/plugin-slug-256x256.png

I have the latest version of both update server and plugin updater. There is a class that extends Wpup_UpdateServer. It's used for license validation. There seems to be nothing related to icons location. Otherwise everything works just fine.

Must be doing something wrong but I don't know what.

Here are some things to try:

  • Try the master branch. The release version is out of date and only the master has the latest features and fixes.
  • Open the metadata URL in the browser and verify that the JSON response shows the correct URLs.
    • If it does, go to the "Plugins" page and click the "Check for updates" link under the plugin description to refresh update information.
    • If it doesn't, check if the class that extends the server happens to override generateAssetUrl(), findFirstAsset(), or $this->assetDirectories. All of those could affect the icon URLs.

Still no luck.

--- Debug output. Request Info button. -------------------------

[banners] => stdClass Object
(
[low] => https://domain-name.net/wp-update-server/banners/plugin-slug-772x250.png
)
[icons] => Array
(
[1x] => https://domain-name.net/wp-update-server/icons/plugin-slug-128x128.png
[2x] => https://domain-name.net/wp-update-server/icons/plugin-slug-256x256.png
)

--- my custom class -----------------------

class myClass extends Wpup_UpdateServer {
protected $serverDirectory;
public function __construct( $serverUrl = null, $serverDirectory = null ) {
parent::__construct( $serverUrl );
$this->serverDirectory = $serverDirectory;
}

--- UpdateServer.php -----------------------

protected function generateBannerUrl($relativeFileName) {
	return $this->generateAssetUrl('banners', $relativeFileName);
}

I've looked at the relevant code once more, and I noticed a bug: when $serverDirectory uses backslashes as directory separators - which is the default on Windows - the update server may generate incorrect URLs for banner and icons exactly like you've shown above. I just committed a patch that should fix this bug - please give it a try.

Note that if you custom class changes $this->serverDirectory to a non-null value, make sure to pass it through the new $this->normalizeFilePath() method. For example:

$this->serverDirectory = $this->normalizeFilePath($somePath);