diff --git a/CHANGELOG.md b/CHANGELOG.md index 328094361b..ed5c1af2c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,9 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ##### Bug Fixes -* None. +* Fix an issue when caching downloads of certain Pods. + [Eric Amorde](https://github.com/amorde) + [#12226](https://github.com/CocoaPods/CocoaPods/issues/12226) ## 1.15.0 (2024-01-28) diff --git a/lib/cocoapods/downloader/cache.rb b/lib/cocoapods/downloader/cache.rb index ebb498df6a..54abe2d870 100644 --- a/lib/cocoapods/downloader/cache.rb +++ b/lib/cocoapods/downloader/cache.rb @@ -327,13 +327,15 @@ def copy_source_and_clean(source, destination, spec) # @return [Void] # def copy_files(files, source, destination) - files = files.select { |f| File.exist?(f) } + files = files. + map { |f| Pathname(f) }. + select { |p| p.exist? && p.file? } destination.parent.mkpath Cache.write_lock(destination) do FileUtils.rm_rf(destination) destination.mkpath files_by_dir = files.group_by do |file| - relative_path = Pathname(file).relative_path_from(Pathname(source)).to_s + relative_path = file.relative_path_from(source) destination_path = File.join(destination, relative_path) File.dirname(destination_path) end