Giter VIP home page Giter VIP logo

carrierwave-ftp's People

Contributors

aishek avatar ashaninbenjamin avatar edjefferson avatar ezekielriva avatar igorbernstein avatar jlecour avatar jschroeder9000 avatar luan avatar mbramire avatar mscottford avatar novikserg avatar phifo avatar r00takaspin avatar tinynumbers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carrierwave-ftp's Issues

Uploader `recreate_versions!` doesn't work

Hi

I'm using carrierwave-ftp 0.3.1 (with carrierwave 1.2.1) to manage some image uploads with versions. I changed the processing of a version and need to reprocess all the existing images. So I'm trying to use recreate_versions! on the uploader:
https://github.com/carrierwaveuploader/carrierwave#recreating-versions

It throws a NameError:

> model.img.recreate_versions!
NameError: undefined local variable or method `file' for #<CarrierWave::Storage::FTP::File:0x00000006345c50>
	from /.../gems/carrierwave-ftp-0.3.1/lib/carrierwave/storage/ftp.rb:76:in `content_type'
	from /.../gems/carrierwave-1.2.1/lib/carrierwave/uploader/cache.rb:86:in `sanitized_file'
	from /.../gems/carrierwave-1.2.1/lib/carrierwave/uploader/cache.rb:118:in `cache!'
	from /.../gems/carrierwave-1.2.1/lib/carrierwave/uploader/versions.rb:227:in `recreate_versions!'

I found this wiki entry: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Recreate-and-reprocess-your-files-stored-on-fog
Which explains that the base img must be cached to reprocess it. It seems like the carrierwave-ftp File class doesn't implement the required methods.

Calling cache_stored_file! on the uploader produces the same error as above.

Thanks !

Change File permissions after upload

Background:
We've been working on a project where the owner gave us a private server via FTP to storage and serve documents and images

Issue:
We use this gem to upload the file perfectly, however We can't serve it due to permissions error.

Fix:
I wrote a quick fix to this. I call the CHMOD command and change the permissions according to the uploader/carrierwave config

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Carrierwave 0.7.1 Compatibility

The Gemspec requires carrierwave ~> 0.6.2. Do you know if it's compatible with carrierwave ~> 0.7.1 ? Thanks, and great project!

sftp_folder doesn't work with absolute path

I ran into an issue with specifying an absolute path to config.sftp_folder. The root of the issue is that the monkey-patched Net::SFTP::Session#mdir_p! can never have a leading '/' in its current implementation. So if I specify

config.sftp_folder = '/foo/bar'

then mkdir_p! creates directories relative to the entry point of the sftp session (the home directory of the sftp user) creating '/home/sftp_user/foo/bar' instead of '/foo/bar'. Then the call to sftp.upload! in the store function correctly uses the absolute path, but the necessary directories weren't created correctly so the upload fails.

I will submit a pull request with a proposed solution shortly.

leaves empty folders when I delete an file

I'm not sure if this behavior is expected or not but every-time a user deletes his file Carrierwave leaves an empty folder instead of delete it.

Is that a known issue?

Uploaded files cannot be read

I have setup carrierwave-ftp to upload image files to a remote ftp server. I am able to upload files to the server without any issues. However, the same images uploaded cannot be read back. I get permission denied error messages. I have used similar setup with carrierwave to upload files to Dropbox without any problems.

My config file looks like this:

CarrierWave.configure do |config|
config.ftp_host = “example.com”
config.ftp_port = 21
config.ftp_user = “username”
config.ftp_passwd = “passord”
config.ftp_folder = "/home5/rails"
config.ftp_url = "ftp://example.com/home5/rails"
config.ftp_passive = false
config.ftp_tls = false
end

My uploader file looks like this:

class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick

storage :ftp

def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end

version :thumb do
process resize_to_fit: [250, 250]
end

def extension_whitelist
%w(jpg jpeg gif png)
end
end

I can't install carrerwave-ftp.

I'm using carrierwave 0.8.0.
I would use carrierwave-ftp.
I wrote " gem 'carrierwave-ftp', :require => 'carrierwave/storage/sftp' " in Gemfile.
I executed "bundle install".

Then This came out.

Bundler could not find compatible versions for gem "carrierwave":
In Gemfile:
carrierwave-ftp (>= 0) ruby depends on
carrierwave (~> 0.6.2) ruby

carrierwave (0.8.0)

help me.

No such file or directory error when uploading from remote url

Greetings,

It appears that when a file is uploaded from a URL, it attempts to upload the files to the wrong directory.

For example:

img = Image.new
img.remote_file_url = "http://server.com/folder/image.jpg"
img.save
Net::FTPPermError: 550 /public_html/images/http://server.com/folder: No such file or directory

As you see it's attempting to save the file in a directory that contains the domain and path from the original file.

Release with fix for Ruby 3.2 and above

There's a PR that went in for addressing the deprecation of the class method File.exists? by updating the net-sftp dependency, see #48. This work is currently unreleased. Please create a release

Update gem on rubygems.org

Hello. I am using this gem in production, works great!

However, there is a minor issue.
Gem version on rubygems.org is outdated with the one provided here.
One of the possible issues with rubygems version is dependency on carrierwave (~> 0.6.2)
While it's not obvious, users can try using this gem with command specified on main page (gem 'carrierwave-ftp' inGemfileinstead of pointing it directly to github repository) and get dependency problem. Can you update the gem onrubygems.org` please?

Wrong instructions on Readme

In the Readme, the line:
config.passive = false # false by default
of the Getting Started (FTP) should be:
config.ftp_passive = false # false by default

Just a little mistake that made me read throug the gem's code to find out.

Thanks :)

private method `file' called for #<CarrierWave ::Storage::FTP::File:0x0000000ca14008>

Hi at all of you, genius!

I have a problem:

I'm using this code in MyfileUploader.rb

def filename
      if 1==1
      new_path = File.join(File.dirname(file.file), model.rename #it's just a text_field in form)
      file.move_to(new_path)
      url = model.rename
    else
      original_filename
    end
  end

I got the error in object:

"private method `file' called for #CarrierWave::Storage::FTP::File:0x0000000ca14008"

If I use storage: file everything works and my file is renamed.

How to fix?

Getting rmagick error when setting sftp_url to https protocol

Hi, when I am setting sftp_url to https, for example

CarrierWave.configure do |config|
  config.sftp_host = "example.com"
  config.sftp_user = "someuser"
  config.sftp_folder = "images"
  config.sftp_url = "https://example.com"
  config.sftp_options = {
      :password => "xxxx",
      :port     => 22
  }
end

I am getting exception CarrierWave::ProcessingError. Here is trace:

carrierwave (0.8.0) lib/carrierwave/processing/rmagick.rb:343:in `rescue in manipulate!'
carrierwave (0.8.0) lib/carrierwave/processing/rmagick.rb:313:in `manipulate!'
carrierwave (0.8.0) lib/carrierwave/processing/rmagick.rb:190:in `resize_to_fill'
carrierwave (0.8.0) lib/carrierwave/uploader/processing.rb:85:in `block in process!'
carrierwave (0.8.0) lib/carrierwave/uploader/processing.rb:81:in `each'
carrierwave (0.8.0) lib/carrierwave/uploader/processing.rb:81:in `process!'
carrierwave (0.8.0) lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks'
carrierwave (0.8.0) lib/carrierwave/uploader/callbacks.rb:18:in `each'
carrierwave (0.8.0) lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks'
carrierwave (0.8.0) lib/carrierwave/uploader/cache.rb:122:in `cache!'
carrierwave (0.8.0) lib/carrierwave/uploader/versions.rb:236:in `block in cache_versions!'
carrierwave (0.8.0) lib/carrierwave/uploader/versions.rb:221:in `each'
carrierwave (0.8.0) lib/carrierwave/uploader/versions.rb:221:in `cache_versions!'
carrierwave (0.8.0) lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks'
carrierwave (0.8.0) lib/carrierwave/uploader/callbacks.rb:18:in `each'
carrierwave (0.8.0) lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks'
carrierwave (0.8.0) lib/carrierwave/uploader/cache.rb:122:in `cache!'
carrierwave (0.8.0) lib/carrierwave/uploader/versions.rb:179:in `recreate_versions!'
app/controllers/admin/photos_controller.rb:17:in `update'

Happens on OSX 10.11.3 and Ubuntu 12.04.

Proc or lambda for ftp_url param

Is it possible in future to set a Proc or lambda for ftp_url param?
It can be usefull if we want to access uploads with random url like that :

CarrierWave.configure do |config|
  config.ftp_host   = "remote.server.tld"
  config.ftp_port   = 21
  config.ftp_user   = "awesome_user"
  config.ftp_passwd = "******"
  config.ftp_folder = "/"
  config.ftp_url    = Proc.new {
    "http://#{Random.rand(16)}.uploads.remote.server.tld"
  }
end

Error when create new item - Net::FTPPermError (550 Failed to change directory. )

Hi , I'm setting up FTP server on a Ubuntu 16.04 in Virtual box with vsftpd.

I can use Windows Explorer to access to the FTP folder, as well as from Ruby code.

image

But I can't get it done with your Gem. whenever I try to upload a new file, it always returns error in the title.

image

Here's my CarrierWave config

CarrierWave.configure do |config|
    config.storage = :file
    config.asset_host = ActionController::Base.asset_host

    config.ftp_host = '192.168.1.101'
    config.ftp_port = 21
    config.ftp_user = 'tom'
    config.ftp_passwd = '1'
    config.ftp_folder = "Desktop/public"   # doesn't work neither with '/Desktop/public'
    config.ftp_url = "http://192.168.1.101/"
    config.ftp_passive = false # false by default

end

Thanks for any help :(

Re-use sftp connection when downloading file

Hi @luan!

Is there a reason why you're using Net::HTTP to download the file? Why not reusing the SFTP connection?

We've ran into a problem, where the URL we used to download the file was a CDN url, meaning all files that will go through CDN and will be cached. The nature of our files is that all of them are temporal, which led to understanding we can't burden the CDN with temp stuff.

We're working on the patch at the moment. Before we submit a PR, I was curious regarding if there was a reason to use Net::HTTP. So far the only need of Net::HTTP I can think of is content-type methods, which we work around by using mime-types gem like such:

MIME::Types.type_for(full_path).first.content_type

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.