afragen / git-updater

This WP plugin will update GitHub, Bitbucket, GitLab, and Gitea hosted plugins and themes
https://git-updater.com
MIT License
3.17k stars 462 forks source link

GitLab translation download: wrong server and PCLZIP_ERR_BAD_FORMAT #890

Closed GuduleLapointe closed 4 years ago

GuduleLapointe commented 4 years ago

I use my own GitLab server, which works great for my plugin. I added * GitLab Languages: https://git.magiiic.com/opensimulator/w4os-translations to get localizations updates.

GitHub updater detects the presence of an update (so it queries my server, so far so good) but then it tries to download it from GitLab.com server: https://gitlab.com/opensimulator/w4os-translations/raw/master/packages/w4os-fr_FR.zip instead of mine: https://git.magiiic.com/opensimulator/w4os-translations/raw/master/packages/w4os-fr_FR.zip

Which produces an error of course, but the message is confusing: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature It would be great to detect the error before trying to unzip, but it would already be interesting to add the download URL to the error message.

afragen commented 4 years ago

Can you provide a Gitlab token for the repository so I can test? You can email or log into the GitHub Updater Slack and DM.

afragen commented 4 years ago

@GuduleLapointe let me know if the latest develop branch fixes this for you.

afragen commented 4 years ago

This may not work as though as the I don't have any way to use an access token when checking a language pack repository. That is why you might need to locate the translations repository somewhere that doesn't require a token for authentication. I'm not sure that GitLab allows unauthenticated API calls. I'll need to test.

It means you may need to put the languages repository on GitHub or Bitbucket. Testing.

GuduleLapointe commented 4 years ago

It's a public repository. However I noticed that the address you built need an authentication, while https://git.magiiic.com/opensimulator/w4os-translations/-/archive/master/w4os-translations-master.zip (the one provided on the git repo download link) is accessible publicly.

GuduleLapointe commented 4 years ago

Sorry I made a mistake and tested with the gitlab address. Both addresses work without authentication or token, the one built "your" way and the one given on the git page. The only one requiring authentication or token is the one with gitlab.com, but it's just because it's a wrong address!

afragen commented 4 years ago

Does all that mean that the language pack updates are working?

GuduleLapointe commented 4 years ago

No, I just checked that my link was available anonymously. Now I'll install the develop branch and check if your fix works.

GuduleLapointe commented 4 years ago

And it does! Thank you very much for your quick answer and fix. And celebrate: now your the language packs work with GitLab repo too!

afragen commented 4 years ago

Also, unless you are using a build process you should remove the Release Asset header.