Account for package metadata that doesn't include filename when deriving hashed filename#496
Account for package metadata that doesn't include filename when deriving hashed filename#496kasparsd wants to merge 7 commits into
Conversation
Signed-off-by: Kaspars Dambis <hi@kaspars.net>
This sample metadata doesn’t have filename returned, for reference https://github.com/fairpm/fair-plugin/releases/latest/download/fair-metadata.json Signed-off-by: Kaspars Dambis <hi@kaspars.net>
Co-authored-by: Colin Stewart <79332690+costdev@users.noreply.github.com> Signed-off-by: Kaspars Dambis <hi@kaspars.net>
Signed-off-by: Kaspars Dambis <hi@kaspars.net>
Signed-off-by: Kaspars Dambis <hi@kaspars.net>
…the DID hash appended Signed-off-by: Kaspars Dambis <hi@kaspars.net>
|
All the code review feedback has been addressed. Added a few additional phpunit test cases to account for the edge cases resolved. |
|
@costdev sorry–I didn't mean to trigger a review from you as I saw your earlier comment. I was attempting to get rid of resolved conversations pertaining to the previous review. Blame it on my github skillz. :) |
|
No worries haha! |
|
Is there a test for the current state of the FAIR Connect where fair-plugin/plugin.php doesn’t list a filename in the metadata? |
|
@afragen Yes, this pull request adds those test cases, including this one with the missing My proposal is to remove the |
|
@kasparsd Can you update status on readiness to merge this PR? It looks like it needs to be rebased against |
|
@cdils This is ready for merge, and it appears to be targeting fairpm:release_1.4.1 already. |
Fixes #492.
Updated
get_hashed_filename()method to build a stable, hashed install path for a FAIR package from its metadata.It works in this order:
filenameinto two parts: a slug-like directory name and a plugin file name.slug.php.wp-plugin, it returns a WordPress-style plugin path in the formslug-didhash/file.php.The intent of this version is:
filenamewhen availablefilenameis missing or incompletedirectory/file.phpExamples for this implementation:
filename = example/example.phpreturnsexample-<hash>/example.phpexample-<hash>/example.phpexamplereturnsexample-<hash>