diff options
author | Vasilii Iakliushin <viakliushin@gitlab.com> | 2020-11-20 17:51:02 +0300 |
---|---|---|
committer | Vasilii Iakliushin <viakliushin@gitlab.com> | 2020-11-20 17:51:02 +0300 |
commit | 0b49afcf128362225682a46289511d7d9f39f1bf (patch) | |
tree | 4853cc9382d3c4844b3c910c2c251e2897fd97ed /lib | |
parent | 62d30b653692a26ef0078b98a242a5867aca0c02 (diff) |
Resolve image realpath before creating a symlink
Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/214164
It should fix the problem with double symlinks to images during
omnibus building process.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/symlinks_converter.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/symlinks_converter.rb b/lib/gitlab/symlinks_converter.rb index 87f91e0c..7ec9473e 100644 --- a/lib/gitlab/symlinks_converter.rb +++ b/lib/gitlab/symlinks_converter.rb @@ -19,10 +19,11 @@ module Gitlab if EXTENTIONS.include?(id.ext) file_path = File.join(ENV['PWD'], config.fetch(:content_dir), id.to_s) + real_path = Pathname.new(file_path).realpath.to_s symlink = File.join(config.output_dir, id.to_s) # Replace a file with a symlink - File.delete(symlink) && File.symlink(file_path, symlink) if File.exist?(symlink) + File.delete(symlink) && File.symlink(real_path, symlink) if File.exist?(symlink) end end end |