Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faulty extraction in remote_file.rb if compressed file contains only .framework #84

Open
3sands opened this issue Jan 17, 2019 · 2 comments

Comments

@3sands
Copy link

3sands commented Jan 17, 2019

I'm trying to download via http a pod that is uploaded as a tarball with only a .framework as its contents. Right now, because the .framework is a technically just a directory, the cocoapods downloader will move the contents of the .framework without consideration of the structure. Specifically, I'm looking at lines 106-122 in remote_file.rb.

# If the archive is a tarball and it only contained a folder, move its
# contents to the target (#727)
#
if should_flatten?
  contents = target_path.children
  contents.delete(target_path + @filename)
  entry = contents.first
  if contents.count == 1 && entry.directory?
    tmp_entry = entry.sub_ext("#{entry.extname}.tmp")
    begin
      FileUtils.move(entry, tmp_entry)
      FileUtils.move(tmp_entry.children, target_path)
    ensure
      FileUtils.remove_entry(tmp_entry)
    end
  end
end

If the conditional is changed to if contents.count == 1 && entry.directory? && File.extname(entry) != '.framework', I am able to successfully pod install. Without it, the named pod folder in the pods directory of the project is empty.

@amorde
Copy link
Member

amorde commented Jan 17, 2019

This should probably be expanded to handle any "directory" that should remain a directory, such as .app, .framework, .ipa, .xcappdata, etc.

@3sands
Copy link
Author

3sands commented Jan 18, 2019

I added a preliminary PR to fix the issue and am available to make any corrections or edits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants