From 9ed282951a9ca1cf5dcc42b3672bef9ff52509f8 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Sun, 5 Jul 2020 19:01:55 +0300
Subject: feat: support googledrive images

---
 src/components/UploadImage/UploadImage.tsx | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/components/UploadImage/UploadImage.tsx')

diff --git a/src/components/UploadImage/UploadImage.tsx b/src/components/UploadImage/UploadImage.tsx
index 737c4df..e9f2168 100644
--- a/src/components/UploadImage/UploadImage.tsx
+++ b/src/components/UploadImage/UploadImage.tsx
@@ -28,6 +28,10 @@ const UploadImage: React.FC<PropTypes> = ({ setIsOpen, isOpen, callback }) => {
       const appendixIndex = url.indexOf('/?utm_source=');
       const baseUrl = url.slice(0, appendixIndex);
       result = `${baseUrl}/media/?size=l`;
+    } else if (url.startsWith('https://drive.google.com/')) {
+      const match = url.match('/d/(.*)/');
+      const fileId = match && match[1];
+      result = `https://drive.google.com/uc?export=view&id=${fileId}`;
     }
     callback(result || '');
     handleClose();
-- 
cgit v1.2.3

