Check URL params defensively, probably fixes #670

merge-requests/575/head
Alex Gleason 2021-07-02 15:06:27 -05:00
rodzic c24c97a320
commit 1cb53b60f9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
7 zmienionych plików z 14 dodań i 7 usunięć

Wyświetl plik

@ -18,7 +18,8 @@ import { openModal } from 'soapbox/actions/modal';
import { NavLink } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const me = state.get('me');
const accounts = state.getIn(['accounts']);
const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase());

Wyświetl plik

@ -18,7 +18,8 @@ import { getSoapboxConfig } from 'soapbox/actions/soapbox';
const emptyList = ImmutableList();
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const me = state.get('me');
const accounts = state.getIn(['accounts']);
const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase());

Wyświetl plik

@ -10,7 +10,8 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
import { debounce } from 'lodash';
import MissingIndicator from 'soapbox/components/missing_indicator';
const mapStateToProps = (state, { params: { username } }) => {
const mapStateToProps = (state, { params }) => {
const username = params.username || '';
const me = state.get('me');
const meUsername = state.getIn(['accounts', me, 'username']);
return {

Wyświetl plik

@ -18,7 +18,8 @@ import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'soapbox/components/missing_indicator';
import { getFollowDifference } from 'soapbox/utils/accounts';
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const me = state.get('me');
const accounts = state.getIn(['accounts']);
const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase());

Wyświetl plik

@ -18,7 +18,8 @@ import ScrollableList from '../../components/scrollable_list';
import MissingIndicator from 'soapbox/components/missing_indicator';
import { getFollowDifference } from 'soapbox/utils/accounts';
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const me = state.get('me');
const accounts = state.getIn(['accounts']);
const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase());

Wyświetl plik

@ -9,7 +9,8 @@ import { injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import MissingIndicator from 'soapbox/components/missing_indicator';
const mapStateToProps = (state, { params: { username } }) => {
const mapStateToProps = (state, { params }) => {
const username = params.username || '';
const me = state.get('me');
const meUsername = state.getIn(['accounts', me, 'username']);
return {

Wyświetl plik

@ -16,7 +16,8 @@ import { getFeatures } from 'soapbox/utils/features';
import { makeGetAccount } from '../selectors';
import { Redirect } from 'react-router-dom';
const mapStateToProps = (state, { params: { username }, withReplies = false }) => {
const mapStateToProps = (state, { params, withReplies = false }) => {
const username = params.username || '';
const accounts = state.getIn(['accounts']);
const accountFetchError = (state.getIn(['accounts', -1, 'username'], '').toLowerCase() === username.toLowerCase());
const getAccount = makeGetAccount();