init.common: Avoid "----" in log filename

When uploading a filename, we sometimes have filename that have many
---- at the end of the filename.

If some of the DMI field had some trailing space, they were replaced by
dashes. So let's remove all trailing spaces before switching
intermediate spaces in dashes.

As a result, no more "----" in the filename.