From 8aef97f8cd31b9b6ca82ef76c872715dfda17c21 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 3 Jul 2019 10:49:28 -0400 Subject: [PATCH] better handle uris on publish page --- package.json | 2 +- src/ui/component/publishForm/view.jsx | 5 +++-- src/ui/component/publishName/view.jsx | 2 +- src/ui/component/selectAsset/view.jsx | 7 +++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 8384700d7..485c46ec6 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "jsmediatags": "^3.8.1", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#009ae8b8fac991c306179b66ac76066e92e16322", + "lbry-redux": "lbryio/lbry-redux#cf4bf4c4896d300827c7e07cdf17ca669394fcc4", "lbryinc": "lbryio/lbryinc#43d382d9b74d396a581a74d87e4c53105e04f845", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/src/ui/component/publishForm/view.jsx b/src/ui/component/publishForm/view.jsx index ddca4b98d..c8d5e1c50 100644 --- a/src/ui/component/publishForm/view.jsx +++ b/src/ui/component/publishForm/view.jsx @@ -1,7 +1,7 @@ // @flow import React, { useEffect, Fragment } from 'react'; import { CHANNEL_NEW, CHANNEL_ANONYMOUS } from 'constants/claim'; -import { buildURI, THUMBNAIL_STATUSES } from 'lbry-redux'; +import { buildURI, isURIValid, THUMBNAIL_STATUSES } from 'lbry-redux'; import Button from 'component/button'; import ChannelSection from 'component/selectChannel'; import classnames from 'classnames'; @@ -112,7 +112,8 @@ function PublishForm(props: Props) { } catch (e) {} } - if (uri) { + const isValid = isURIValid(uri); + if (uri && isValid) { resolveUri(uri); updatePublishForm({ uri }); } diff --git a/src/ui/component/publishName/view.jsx b/src/ui/component/publishName/view.jsx index af458af21..b5862dea7 100644 --- a/src/ui/component/publishName/view.jsx +++ b/src/ui/component/publishName/view.jsx @@ -49,7 +49,7 @@ function PublishName(props: Props) { if (!name) { nameError = __('A name is required'); } else if (!isNameValid(name, false)) { - nameError = __('LBRY names cannot contain that symbol ($, #, @)'); + nameError = __('LBRY names cannot contain spaces or reserved symbols ($#@;/"<>%{}|^~[]`)'); } setNameError(nameError); diff --git a/src/ui/component/selectAsset/view.jsx b/src/ui/component/selectAsset/view.jsx index 0e45297a3..3662b3ef5 100644 --- a/src/ui/component/selectAsset/view.jsx +++ b/src/ui/component/selectAsset/view.jsx @@ -36,7 +36,11 @@ function SelectAsset(props: Props) { function doUploadAsset(filePath, thumbnailBuffer) { let thumbnail, fileExt, fileName, fileType; - // @if TARGET='app' + if (IS_WEB) { + console.error('no upload support for web'); + return; + } + if (filePath) { thumbnail = fs.readFileSync(filePath); fileExt = path.extname(filePath); @@ -50,7 +54,6 @@ function SelectAsset(props: Props) { } else { return null; } - // @endif const uploadError = (error = '') => { console.log('error', error);