It's not so easy. After applying suggested patch I was able to upload file, but didn't see it in list.
I updated L36 from
@containers += @project.versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
to
@containers += @project.shared_versions.find(:all, :include => :attachments, :order => sort_clause).sort.reverse
and now I see all files attached to shared version in all projects that share this version!
I.e. Root project and subproject both have the same list of files for shared version,
however some of these files were uploaded in root project and some - in subproject.
In database, each attachment has container. When versions were not shared there was one-to-one
correspondence between versions and projects and files were listed only in one project.
If version is shared there is no way to determine a project in which file was uploaded
and all files are listed in all projects that share this version.
And I don't see a way to fix this bug without changing of database structure.