GithubHelp home page GithubHelp logo

Support for redirects about shrine-url HOT 6 CLOSED

shrinerb avatar shrinerb commented on June 2, 2024
Support for redirects

from shrine-url.

Comments (6)

janko avatar janko commented on June 2, 2024 2

I updated Shrine::Storage::Url#exists?and Down::NetHttp#open to follow redirects (so switching to Down::Http shouldn't be needed). I released shrine-url 1.0.2 and down 4.2.0 with these changes.

from shrine-url.

lcmen avatar lcmen commented on June 2, 2024 1

@janko-m that's great! I will try to switch the backend after the Christmas and let you know if it solves the problem for us.

Thanks again for your excellent support!

from shrine-url.

janko avatar janko commented on June 2, 2024

@lucasm-iRonin Shrine::Storage::Url#download already automatically follows up to 2 redirects by default. Shrine::Storage::Url#open doesn't follow redirects with the default Down::NetHttp backend, though it does with Down::Http and Down::Wget. I will modify Down::NetHttp#open to follow redirects.

Shrine::Storage::Url#exists? also obviously doesn't follow redirects, though it's never used automatically by Shrine, it's only used if the user calls Shrine::UploadedFile#exists?. I could update #exists? to follow redirects, but I think it would even be sufficient to just include 3xx in "successful response codes".

from shrine-url.

lucasm-iRonin avatar lucasm-iRonin commented on June 2, 2024

@janko-m thanks for quick reply. I didn't know that following redirects may depend on the backend - we were using the default one which is Down::NetHTTP. I can try to switch to other backend to see if it solves the problem.

The case with dropbox links is quite specific - redirects are single time use. If we use refresh_metadata plugin does Shrine-url will be able to handle that? First download will be necessary to get the file's metadata and then another one will actually download the file - those 2 requests will need to generate a fresh link from the original dropbox link by following the redirect one more time.

from shrine-url.

janko avatar janko commented on June 2, 2024

@lucasm-iRonin Shrine-url will make every request to the original URL (which will redirect to the destination URL), so the destination URL will not be reused.

from shrine-url.

lucasm-iRonin avatar lucasm-iRonin commented on June 2, 2024

@janko-m I've just checked it and it works fine. Thanks again!

from shrine-url.

Related Issues (6)

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.