[5.2] FIX xml sha verification for update server #44336
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added an optional sha512 hash to my update extension xml file, which is autogenerated for the extension update zip-file. Deploying my extension on an Update Server which is also described here: https://manual.joomla.org/docs/building-extensions/install-update/update-server/.
When there is a space and/or newline, which I unfortunately added in my xml file, the upload breaks.
Summary of Changes
Trimming of the sha512 string value (and other hashes) in the validation of the hash from the xml update file.
Testing Instructions
Alternative test (from @obuisard):
1 - Download the test extension https://updates.simplifyyourweb.com/free/backgroundstretch/v200/mod_backgroundstretch.zip
2 - Install on a test site.
3 - The version of the module is 2.0.0. A 2.0.1 update is available. Go to Extensions -> Update.
4 - Check for updates (the update server's xml file contains spaces like above).
5 - Try and update 'Background Stretch'.
6 - Before using this patch, the update should fail with a message like this one:
The checksum verification failed. Please make sure you are using the correct update server!
7 - Apply the PR.
8 - When trying to update, the update should go through.
Actual result BEFORE applying this Pull Request
The update is canceled because the two hashes are different.
Expected result AFTER applying this Pull Request
The update is done because the two hashes are identical.
Link to documentations
Please select:
Documentation link for docs.joomla.org: https://manual.joomla.org/docs/building-extensions/install-update/update-server/
No documentation changes for docs.joomla.org needed
No documentation changes for manual.joomla.org needed