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:
commit
35ead98cbf
@ -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
|
||||
|
@ -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', [
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user