mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
FIX: Don't fail when there's no directory to strip
This commit is contained in:
parent
c5326682d6
commit
fa66290b61
|
@ -33,8 +33,10 @@ module Compression
|
|||
end
|
||||
|
||||
def strip_directory(from, to, relative: false)
|
||||
sanitized_from = sanitize_path(from)
|
||||
sanitized_to = sanitize_path(to)
|
||||
sanitized_from = sanitize_path(from) rescue nil
|
||||
sanitized_to = sanitize_path(to) rescue nil
|
||||
return unless sanitized_from && sanitized_to
|
||||
|
||||
glob_path = relative ? "#{sanitized_from}/*/*" : "#{sanitized_from}/**"
|
||||
FileUtils.mv(Dir.glob(glob_path), sanitized_to) if File.directory?(sanitized_from)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user