Previously, there were many, many places i nthe code performing a
calculation of:
"_".join(name.split())
in order to replace all spaces with underscores before using a name as
a filename.
But as we determined recently, this is insufficient as we at least
need to also replaces all '/' with an '_' as well (to ensure that the
filename looks like a filename and not a directory plus a filename).
The previous fix for the '/' in one place, (immediately before writing
the file), meant that all the other places that were emitting links to
that file were now wrong.
We can ensure everything is consistent by having a single function for
all instances of this filename generation which we do here with the
new filename_from_name() function.