From 539cf32f87eb1b517a177b66f6aaf9d3a1b3f751 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 17 May 2018 12:43:30 +0530 Subject: [PATCH] FIX: handle encoded mailto links when looking for upload record --- app/models/upload.rb | 2 +- spec/models/upload_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/upload.rb b/app/models/upload.rb index 055b396e272..a9907954922 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -84,7 +84,7 @@ class Upload < ActiveRecord::Base # always try to get the path uri = begin - URI(url) + URI(URI.unescape(url)) rescue URI::InvalidURIError end diff --git a/spec/models/upload_spec.rb b/spec/models/upload_spec.rb index e7d9fdde7a8..a7c0d4ab0e8 100644 --- a/spec/models/upload_spec.rb +++ b/spec/models/upload_spec.rb @@ -87,6 +87,7 @@ describe Upload do it "doesn't blow up with an invalid URI" do expect { Upload.get_from_url("http://ip:port/index.html") }.not_to raise_error + expect { Upload.get_from_url("mailto:admin%40example.com") }.not_to raise_error end describe "s3 store" do