Walter
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/1EAE9CB4-3AA9-438D-9C1D-2C0C8B4005CA%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/f0666a2a-82ea-4d28-be75-3b4f183a755b%40googlegroups.com.
I just tested again, and the original application (with CarrierWave) was able to work, but the differences between that application and the new one are many and varied, down to the major and minor version of Rails. We are not running a modern version of CarrierWave, either. Old software for old servers, I guess.
I will test using the Net::HTTP direct mode, I think you posted some code earlier in this thread that would allow us to hand-roll the downloader.
Are you the author of Down as well?
> To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
> To post to this group, send email to ruby-...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/f0666a2a-82ea-4d28-be75-3b4f183a755b%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Shrine" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
f = open('https://[server.name].upenn.edu/[user]/my/fapd/apps/feds/download.php?cv=12345', 'Cookie'=> 'CID=[REDACTED]')
require "shrine"
require "shrine/storage/file_system"
require "down/http"
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new(Dir.tmpdir),
store: Shrine::Storage::FileSystem.new(Dir.tmpdir),
}
Shrine.plugin :determine_mime_type
Shrine.plugin :remote_url, downloader: Down::Http.method(:download), max_size: 10*1024*1024
class Photo
include Shrine::Attachment.new(:image)
attr_accessor :image_data
end
photo = Photo.new
photo.image_attacher.assign_remote_url("https://httpbin.org/cookies", downloader: {
headers: { "Cookie" => "CID=12345" }
})
puts photo.image.read
#=> '{"cookies":{"CID":"12345"}}'
photo = Photo.new
photo.image_attacher.assign_remote_url("https://httpbin.org/redirect-to", downloader: {
params: { url: "https://httpbin.org/cookies" },
headers: { "Cookie" => "CID=12345" },
})
puts photo.image.read
#=> '{"cookies":{"CID":"12345"}}'
On a side note, and unrelated to the use of your code, the stock example from the documentation is giving me a rubocop error (multiline procs should be written using the lambda method), but when I tried to rewrite this as a lambda, I get an error at application startup that I am trying to run a proc without arguments, and the server won't start. I gave up and disabled that cop for now.
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/1d5dfe83-5199-4fae-bea3-245600360fce%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/2fa79654-9782-4ca4-b5a3-83de4ee7b8ff%40googlegroups.com.
require "shrine"
require "shrine/storage/file_system"
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new(Dir.tmpdir),
store: Shrine::Storage::FileSystem.new(Dir.tmpdir),
}
Shrine.plugin :determine_mime_type # get rid of the deprecation warning
Shrine.plugin :remote_url, max_size: 50*1024*1024
class Photo
include Shrine::Attachment.new(:image)
attr_accessor :image_data
end
photo = Photo.new
photo.image_attacher.assign_remote_url("https://httpbin.org/cookies", downloader: { "Cookie" => "CID=12345" })
puts photo.image.read
#=> '{"cookies":{"CID":"12345"}}'
photo = Photo.new
photo.image_attacher.assign_remote_url("https://httpbin.org/redirect-to?url=/cookies", downloader: { "Cookie" => "CID=12345" })
puts photo.image.read
#=> '{"cookies":{"CID":"12345"}}'
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/e81de5e3-296f-4ca3-9ee4-d0a69af8f68e%40googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/ruby-shrine/2fa79654-9782-4ca4-b5a3-83de4ee7b8ff%40googlegroups.com?utm_medium=email&utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href='https://groups.google.com/d/msgid/ruby-shrine/2fa79654-9782-4ca4-b5a3-83de4ee7b8ff%40googlegroups.com?utm_medium\x3demail\x26utm_source\x
In your last comment yesterday, you said that the default behavior (without writing a custom downloader proc) was to just accept and pass through additional options. I haven't tried this yet, but what chances do you give this configuration to work if the real problem is the limited number of allowed redirects?
Shrine.plugin :remote_url, max_size: 50.megabytes, follow: { max_hops: 8 }
--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/4441529b-f827-48aa-b419-9045fd872417%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
Okay, we are much closer to success now. I have gotten to the page requesting a login (not what I want, but at least I can see it and understand where the failure is happening). Just to triple check, I have done these three things:1. shrine.rb: require 'shrine'; require 'shrine/storage/file_system'; Shrine.plugin :remote_url, max_size: 50.megabytes2. controller:def import(remote_url)Rails.logger.info "#{remote_url}, downloader: { 'Cookie' => #{'CID=' + cookies[:CID]}, max_redirects: 8 }"
@document.file_attacher.assign_remote_url(remote_url,downloader: { 'Cookie' => 'CID=' + cookies[:CID],
And would you say that NetHttp is the closest thing to open-uri, options-wise?
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/2dadf0bb-96e4-4ba9-859e-4a1d2a68f0cd%40googlegroups.com.