diff options
author | eug-vs <eug-vs@keemail.me> | 2020-07-05 19:16:01 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-07-05 19:16:01 +0300 |
commit | 8c5c26166b2e13b97d57e3a1ee10ebc48ba6f416 (patch) | |
tree | 554de4ff79bf6f91d59d992dc0da15e596e6f0c2 | |
parent | f7fc3b984eb90d282c932dfe38965686122a729c (diff) | |
download | which-ui-8c5c26166b2e13b97d57e3a1ee10ebc48ba6f416.tar.gz |
fix: use regex in instagram link resolver
-rw-r--r-- | package-lock.json | 2 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/components/UploadImage/UploadImage.tsx | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/package-lock.json b/package-lock.json index 6402a10..59b1f75 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "which", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 268754c..676e20a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "which", - "version": "1.0.2", + "version": "1.0.3", "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 e9f2168..238d5cd 100644 --- a/src/components/UploadImage/UploadImage.tsx +++ b/src/components/UploadImage/UploadImage.tsx @@ -25,9 +25,9 @@ const UploadImage: React.FC<PropTypes> = ({ setIsOpen, isOpen, callback }) => { const handleSubmit = () => { let result = url; if (url.startsWith('https://www.instagram.com/')) { - const appendixIndex = url.indexOf('/?utm_source='); - const baseUrl = url.slice(0, appendixIndex); - result = `${baseUrl}/media/?size=l`; + const match = url.match('/p/(.*)/'); + const id = match && match[1]; + result = `https://www.instagram.com/p/${id}/media/?size=l`; } else if (url.startsWith('https://drive.google.com/')) { const match = url.match('/d/(.*)/'); const fileId = match && match[1]; |