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

X-Copy-From request send "application/json" as content type #512

Open
nhh opened this issue May 29, 2020 · 1 comment
Open

X-Copy-From request send "application/json" as content type #512

nhh opened this issue May 29, 2020 · 1 comment

Comments

@nhh
Copy link

nhh commented May 29, 2020

I am processing videos with carrierwave and fog as storage provider. All videos that are uploaded have the content type "application/json". I already got so far, that i have overriden the CarrierWave::Storage::Fog::File#content_type method but with no success. With that tried i've come to the conclusion, that there is something wrong underneath my processing code.

What i can see with EXCON_DEBUG=true is, that the first request, putting my video into a temp file, works as expected:

:method              => "PUT"
:headers             => {
    "Accept"         => "application/json"
    "Content-Length" => 3267624
    "Content-Type"   => "video/quicktime"
    "Host"           => "storage.sbg.cloud.ovh.net:443"
    "User-Agent"     => "fog-core/2.2.0"
    "X-Auth-Token"   => "XXXXXXXX"
}

I get a 201 Created back. After that, carrierwave processes the file and moves it with fog-openstack into is real destination:

:headers             => {
    "Accept"       => "application/json"
    "Content-Type" => "application/json"
    "Host"         => "storage.sbg.cloud.ovh.net:443"
    "User-Agent"   => "fog-core/2.2.0"
    "X-Auth-Token" => "XXXXXXXX"
    "X-Copy-From"  => "/XXXX_development/uploads/tmp/1590760935-202723548356984-0001-0409/loading_screen_flickers.mov"
  }

The response for the copy request looks as following:

  :headers       => {
    "Content-Length"              => "0"
    "Content-Type"                => "text/html; charset=UTF-8"
    "Date"                        => "Fri, 29 May 2020 14:02:20 GMT"
    "Etag"                        => "e1340ff8ddfb1a8ae1252bc55dae7f85"
    "Last-Modified"               => "Fri, 29 May 2020 14:02:20 GMT"
    "X-Copied-From"               => "XXX_development/uploads/tmp/1590760935-202723548356984-0001-0409/loading_screen_flickers.mov"
    "X-Copied-From-Account"       => "XXXXXXXXXXXX"
    "X-Copied-From-Last-Modified" => "Fri, 29 May 2020 14:02:18 GMT"
    "X-IPLB-Instance"             => "12631"
    "X-Openstack-Request-Id"      => "tx3905d22b0674473e9bd0f-005ed115eb"
    "X-Trans-Id"                  => "tx3905d73b0671173e9bd0f-005ed115eb"
  }

After that, the file which got moved will only be accessible via content type "application/json".

Any ideas?

Best,
Niklas

@cutalion
Copy link

cutalion commented Nov 24, 2020

I have the same issue with fog-core 1.45.0, fog-openstack 0.3.10 and carrierwave 2.1.0.
I had to set local cache (cache_storage :file) in carrierwave not to move files remotely via X-Copy-From header

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

No branches or pull requests

2 participants