diff --git a/static/app-strings.json b/static/app-strings.json index 01532b8df..9a8be86fe 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -922,11 +922,14 @@ "The wallet server took a bit too long. Resetting defaults just in case. Shutdown (Cmd/Ctrl+Q) LBRY and restart if this continues.": "The wallet server took a bit too long. Resetting defaults just in case. Shutdown (Cmd/Ctrl+Q) LBRY and restart if this continues.", "Provide a description and link to your license": "Provide a description and link to your license", "Wallet servers": "Wallet servers", - "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.", "Followers": "Followers", "%number% files hidden due to your %content_viewing_preferences_link%": "%number% files hidden due to your %content_viewing_preferences_link%", "Use official lbry.tv wallet servers": "Use official lbry.tv wallet servers", "Use custom wallet servers": "Use custom wallet servers", "Remove custom wallet server": "Remove custom wallet server", - "Add": "Add" + "Add": "Add", + "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.", + "lbry.tv": "lbry.tv", + "Your Blocked Channels": "Your Blocked Channels", + "Bid position must be a number.": "Bid position must be a number." } diff --git a/ui/component/publishFile/view.jsx b/ui/component/publishFile/view.jsx index 2aea0da93..eeb1e90ef 100644 --- a/ui/component/publishFile/view.jsx +++ b/ui/component/publishFile/view.jsx @@ -54,8 +54,8 @@ function PublishFile(props: Props) { }; // Strip off extention and replace invalid characters let fileName = file.name.substr(0, file.name.lastIndexOf('.')) || file.name; - let replaceChars = new RegExp(regexInvalidURI, 'gu'); - let parsedFileName = fileName.replace(replaceChars, '-'); + let INVALID_URI_CHARS = new RegExp(regexInvalidURI, 'gu'); + let parsedFileName = fileName.replace(INVALID_URI_CHARS, '-'); if (!isStillEditing) { publishFormParams.name = parsedFileName; } diff --git a/ui/page/search/view.jsx b/ui/page/search/view.jsx index ea069362a..658e9bd90 100644 --- a/ui/page/search/view.jsx +++ b/ui/page/search/view.jsx @@ -1,7 +1,7 @@ // @flow import * as ICONS from 'constants/icons'; import React, { useEffect, Fragment } from 'react'; -import { isURIValid, normalizeURI } from 'lbry-redux'; +import { isURIValid, normalizeURI, regexInvalidURI } from 'lbry-redux'; import ClaimPreview from 'component/claimPreview'; import ClaimList from 'component/claimList'; import Page from 'component/page'; @@ -22,12 +22,16 @@ export default function SearchPage(props: Props) { const { search, uris, onFeedbackPositive, onFeedbackNegative, location, isSearching } = props; const urlParams = new URLSearchParams(location.search); const urlQuery = urlParams.get('q'); - const isValid = isURIValid(urlQuery); - let uri; - if (isValid) { - uri = normalizeURI(urlQuery); - } + let INVALID_URI_CHARS = new RegExp(regexInvalidURI, 'gu'); + let modifiedUrlQuery = urlQuery + ? urlQuery + .trim() + .replace(/\s+/, '-') + .replace(INVALID_URI_CHARS, '') + : ''; + const isModifiedUriValid = isURIValid(modifiedUrlQuery); + const normalizedModifiedUri = isModifiedUriValid && normalizeURI(modifiedUrlQuery); useEffect(() => { if (urlQuery) { @@ -40,11 +44,11 @@ export default function SearchPage(props: Props) {
{urlQuery && ( - {isValid && ( + {isModifiedUriValid && (
- +
- +
)}