From 341e71ae86dd2db15d9e27e477bfbe24f69d463c Mon Sep 17 00:00:00 2001 From: ci2014 Date: Fri, 18 Aug 2017 15:39:38 +0200 Subject: [PATCH] Update file.py There were problems with Image links from Facebook for example, because they have and need ?parameter1=abc¶meter2=def in their address. --- frappe/core/doctype/file/file.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frappe/core/doctype/file/file.py b/frappe/core/doctype/file/file.py index a27d183fe4..6dcc94fa5e 100755 --- a/frappe/core/doctype/file/file.py +++ b/frappe/core/doctype/file/file.py @@ -329,7 +329,12 @@ def setup_folder_path(filename, new_parent): def get_extension(filename, extn, content): mimetype = None + if extn: + # remove '?' char and parameters from extn if present + if '?' in extn: + extn = extn.split('?', 1)[0] + mimetype = mimetypes.guess_type(filename + "." + extn)[0] if mimetype is None or not mimetype.startswith("image/") and content: