Open pali opened 7 years ago
Other option is to order all MIME parts (vertices of rooted tree) by some stable algorithm and assign index in ordered list. The most common usage is invent filename for just for leafs, so ordering could start from bottom leafs up to root vertex, to have only small numbers used in invented files for most cases.
Method
invent_filename
is used by methodfilename
which returns suggested file name.But
invent_filename
uses module global variable counter which is appended into returned file name. Therefore methodfilename
is not stable as documented in Email::MIME documentation and depends on order of Email::MIME objects on which wereinvent_filename
resp.filename
called.MIME email is tree structure and every vertex is MIME part on which can be called
invent_filename
method. Therefore stable implementation ofinvent_filename
method must uniquely encode vertex in the tree. MIME email is rooted tree, so vertex can be encoded by just the path from root.