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

block validation link when hosting is on g drive

This commit is contained in:
EnzoVezzaro 2022-11-02 06:32:35 -04:00
parent d1e3fa9afa
commit 7fc5418189
2 changed files with 19 additions and 2 deletions

View File

@ -1,4 +1,4 @@
import React, { ReactElement, useState } from 'react' import React, { ReactElement, useEffect, useState } from 'react'
import { useField, useFormikContext } from 'formik' import { useField, useFormikContext } from 'formik'
import FileInfo from './Info' import FileInfo from './Info'
import UrlInput from '../URLInput' import UrlInput from '../URLInput'
@ -23,6 +23,14 @@ export default function FilesInput(props: InputProps): ReactElement {
? values?.services[0].providerUrl.url ? values?.services[0].providerUrl.url
: asset.services[0].serviceEndpoint : asset.services[0].serviceEndpoint
setIsLoading(true) 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) const checkedFile = await getFileUrlInfo(url, providerUrl)
// error if something's not right from response // error if something's not right from response

View File

@ -60,7 +60,16 @@ export default function FormEditMetadata({
asset?.metadata?.links?.[0] && asset?.metadata?.links?.[0] &&
getFileUrlInfo(asset.metadata.links[0], providerUrl).then( getFileUrlInfo(asset.metadata.links[0], providerUrl).then(
(checkedFile) => { (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 // initiate link with values from asset metadata
setFieldValue('links', [ setFieldValue('links', [
{ {