1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

Merge pull request #1766 from oceanprotocol/fix/issue-validation-g-drive-links

fix validation link field on edit view when the asset is already hosted on g drive
This commit is contained in:
EnzoVezzaro 2022-11-17 06:58:25 -04:00 committed by GitHub
commit 35ead98cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -21,6 +21,14 @@ export default function FilesInput(props: InputProps): ReactElement {
? props.form?.values?.services[0].providerUrl.url
: asset.services[0].serviceEndpoint
setIsLoading(true)
// TODO: handled on provider
if (url.includes('drive.google')) {
throw Error(
'Google Drive is not a supported hosting service. Please use an alternative.'
)
}
const checkedFile = await getFileUrlInfo(url, providerUrl)
// error if something's not right from response

View File

@ -60,7 +60,16 @@ export default function FormEditMetadata({
asset?.metadata?.links?.[0] &&
getFileUrlInfo(asset.metadata.links[0], providerUrl).then(
(checkedFile) => {
console.log(checkedFile)
// set valid false if url is using google drive
if (asset.metadata.links[0].includes('drive.google')) {
setFieldValue('links', [
{
url: asset.metadata.links[0],
valid: false
}
])
return
}
// initiate link with values from asset metadata
setFieldValue('links', [
{