lbry-desktop/ui/component/uriIndicator/index.js
infinite-persistence a34e07e970 uriIndicator: calling normalizeURI called without a try-catch
Closes 1048 - "There was a bad URL without a letter after #, and this failed on resolve + crashed the app. Maybe a try/catch for each URL?"
2022-03-09 09:47:31 -05:00

24 lines
647 B
JavaScript

import { connect } from 'react-redux';
import { normalizeURI } from 'util/lbryURI';
import { doResolveUri } from 'redux/actions/claims';
import { selectIsUriResolving, selectClaimForUri } from 'redux/selectors/claims';
import UriIndicator from './view';
const select = (state, props) => {
let uri = null;
try {
uri = normalizeURI(props.uri);
} catch {}
return {
claim: selectClaimForUri(state, props.uri),
isResolvingUri: selectIsUriResolving(state, props.uri),
uri,
};
};
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
});
export default connect(select, perform)(UriIndicator);