TS-2553 Fix a crash in the Metalink plugin

More work to fix this crash.
I think the existing CHANGES entry for this issue still covers it.
There are also some minor edits and I added some functional tests for exercising the plugin. (The tests could potentially also exercise other null transform plugins.)
Let me know if the style or process for contributing changes could be improved, and feel free to squash the changes to clean them up.
Thanks!