Fixes #26022 - Fix handling of files with trailing slash - Fix handling of duplicate package file errors - Added test for both