diff options
author | eug-vs <eug-vs@keemail.me> | 2020-07-05 18:55:47 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-07-05 18:55:47 +0300 |
commit | b6d39f5efa484152eb9688489f32d73eec250922 (patch) | |
tree | 809b34b407444eb71c04ceaadf1f2cbb620bc4e3 | |
parent | 056bfe1fb3aa23ce45f068cf3c138a02293adaa2 (diff) | |
download | which-ui-b6d39f5efa484152eb9688489f32d73eec250922.tar.gz |
fix: ignore instagram url appendix
-rw-r--r-- | src/components/UploadImage/UploadImage.tsx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/UploadImage/UploadImage.tsx b/src/components/UploadImage/UploadImage.tsx index 5b2f38e..737c4df 100644 --- a/src/components/UploadImage/UploadImage.tsx +++ b/src/components/UploadImage/UploadImage.tsx @@ -25,8 +25,8 @@ 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`; } callback(result || ''); |