diff options
-rw-r--r-- | package-lock.json | 2 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/components/UploadImage/UploadImage.tsx | 8 |
3 files changed, 8 insertions, 4 deletions
diff --git a/package-lock.json b/package-lock.json index 0f360a2..6402a10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "which", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f3ab8c4..268754c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "which", - "version": "1.0.1", + "version": "1.0.2", "homepage": "https://ilyayudovin.github.io/which", "dependencies": { "@material-ui/core": "^4.10.1", 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(); |