fix for files that have digests in name bug

Files named as GUIDs or other naming schemes that inlude digest-like
patterns in their name, are now handled correctly by the regex that
extracts digest from the filename.

A nicer fix that the one in pull-request #396.
Also related to https://github.com/rails/rails/issues/9788