Download a file, with filename defined from flow context variable, with a button

I have a flow that takes data supplied over MQTT, plots it, and can save it to a file, with the filename defined in a text input field (filename then gets saved to a flow context variable). I'd like to have a button that, upon being clicked, causes the file defined in the text input field to be downloaded (it is a text file). I've tried following the example shown at

but I cannot figure out how to get the filename to be defined by the context variable, as opposed to hardcoded into the template node. I've tried to pull it from the context variable into a msg.payload with a change node (as described in Template ui-template | Node-RED Dashboard 2.0 ) and then feed that into the template node and use {{msg.payload}} or "msg.payload" in the template code, but any time I do that, the entire dashboard refuses to load (hangs at a logo of the Dashboard), and it won't go back to loading the dashboard until I remove any reference to msg.payload from the template node. Also the template node as shown in the example provides a link instead of a button (a dashboard button would be preferable), but that's not critical.
I imagine that the example at Download a file from node-red using standard nodes (flow) - Node-RED is almost what I need, but I can't figure out how to get the filename set from the flow context variable (and preferable a dashboard button instead of a link)

To follow up, instead of using the template node, I've tried making a button that, upon clicking, sends a msg.url containing "/files/filename.log" to a HTTP request node, and combining that with the example that makes the /files/ endpoint, but I just get "No response object" errors

{"message":"RequestError: getaddrinfo ENOTFOUND files","source":{"id":"277d35b04137ce04","type":"http request","count":1},"stack":"RequestError: getaddrinfo ENOTFOUND files\n    at ClientRequest.<anonymous> (file:///usr/lib/node_modules/node-red/node_modules/got/dist/source/core/index.js:790:107)\n    at Object.onceWrapper (node:events:633:26)\n    at ClientRequest.emit (node:events:530:35)\n    at emitErrorEvent (node:_http_client:101:11)\n    at Socket.socketErrorListener (node:_http_client:504:5)\n    at Socket.emit (node:events:518:28)\n    at emitErrorNT (node:internal/streams/destroy:169:8)\n    at emitErrorCloseNT (node:internal/streams/destroy:128:3)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26)"}