links: prevents title from being overwritten

fixes #3481
This commit is contained in:
Tyler Brown Cifu Shuster 2020-09-17 20:26:19 -07:00
parent 6f5663bcd3
commit 797fb47243

View File

@ -83,11 +83,11 @@ export class LinkSubmit extends Component<LinkSubmitProps, LinkSubmitState> {
fetch(`https://noembed.com/embed?url=${linkValue}`) fetch(`https://noembed.com/embed?url=${linkValue}`)
.then(response => response.json()) .then(response => response.json())
.then((result) => { .then((result) => {
if (result.title) { if (result.title && !this.state.linkTitle) {
this.setState({ linkTitle: result.title }); this.setState({ linkTitle: result.title });
} }
}).catch((error) => {/*noop*/}); }).catch((error) => {/*noop*/});
} else { } else if (!this.state.linkTitle) {
this.setState({ this.setState({
linkTitle: decodeURIComponent(linkValue linkTitle: decodeURIComponent(linkValue
.split('/') .split('/')