diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-07-05 19:05:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-05 19:05:29 +0300 |
commit | f7fc3b984eb90d282c932dfe38965686122a729c (patch) | |
tree | 5d1f8019c8fd019b2fd3813348e7f5745e05fe7a /src/components | |
parent | 056bfe1fb3aa23ce45f068cf3c138a02293adaa2 (diff) | |
parent | 8bd541ccb46658f6ff079c0ab24b3c7f246eb9ec (diff) | |
download | which-ui-f7fc3b984eb90d282c932dfe38965686122a729c.tar.gz |
Merge pull request #66 from which-ecosystem/fix-googledrive
Patch 1.0.2
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/UploadImage/UploadImage.tsx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/components/UploadImage/UploadImage.tsx b/src/components/UploadImage/UploadImage.tsx index 5b2f38e..e9f2168 100644 --- a/src/components/UploadImage/UploadImage.tsx +++ b/src/components/UploadImage/UploadImage.tsx @@ -25,9 +25,13 @@ const UploadImage: React.FC<PropTypes> = ({ setIsOpen, isOpen, callback }) => { const handleSubmit = () => { let result = url; if (url.startsWith('https://www.instagram.com/')) { - const lastSlashIndex = url.lastIndexOf('/'); - const baseUrl = url.slice(0, lastSlashIndex); + 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(); |