FIX: Old Upload#url scheme support for Upload.get_from_url.

This is for backwards compatibility purposes. Even if `Upload#url` has a
format that we don't recognize, we should still return the upload object
as long as the upload record is present.
This commit is contained in:
Guo Xiang Tan
2019-04-24 10:15:47 +08:00
parent 646cdfa449
commit a8baa6d9e7
2 changed files with 13 additions and 1 deletions

View File

@ -122,6 +122,12 @@ describe Upload do
end
end
it "should return the right upload as long as the upload's URL matches" do
upload.update!(url: "/uploads/default/12345/971308e535305c51.png")
expect(Upload.get_from_url(upload.url)).to eq(upload)
end
describe 'for a url a tree' do
before do
upload.update!(url: