Delete invalid symlinks referencing identity-idp-config#8786
Delete invalid symlinks referencing identity-idp-config#8786mitchellhenke merged 1 commit intomainfrom
Conversation
changelog: Bug Fixes, Asset Compilation, Delete invalid symlinks referencing identity-idp-config
| Dir.entries(idp_logos_dir).each do |name| | ||
| next if name.start_with?('.') | ||
| target = File.join(idp_logos_dir, name) | ||
| File.rm(target) if File.symlink?(target) && !File.file?(target) |
There was a problem hiding this comment.
would we ever have to worry that we have a symlink to a directory or something?
There was a problem hiding this comment.
Not currently I don't think. The logo directory should only contain files.
Sgtpluck
left a comment
There was a problem hiding this comment.
i like the approach! if it turns out it doesn't work for some reason, would the delete all/recreate symlinks approach still be in play?
is there value in testing against zach's comment? (ie, that there are only files in the directory)
Yep, absolutely
I lean towards excluding it for now since I'm not sure the implementation can accommodate anything but a single level of files. My assumption from there is if that changed, we could tackle both at the same time? |
🛠 Summary of changes
This is still a bit experimental and I'm working to confirm that the theory below is correct and the proposed solution resolves the problem we're seeing every now and then.
We've run into the situation a couple times where a built application artifact includes symlinks to the identity-idp-config directory. Since identity-idp-config is cloned each time regardless of whether the artifact exists for the SHA, it is possible for an SP logo to be deleted from identity-idp-config which breaks the symlink and can cause build or provisioning issues.
This PR goes through the target
publicdirectory for SP logos and deletes any symlinks that exist but do not link to an existing file.Other options: