mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
replaced local isUrl with is-super-url
This commit is contained in:
parent
f4f7ecefc8
commit
188f60e7de
@ -134,7 +134,6 @@ export default function FormPublish(): ReactElement {
|
||||
<Field
|
||||
key={field.name}
|
||||
{...field}
|
||||
disabled={field.disabled}
|
||||
component={Input}
|
||||
onChange={(e: ChangeEvent<HTMLInputElement>) =>
|
||||
handleFieldChange(e, field)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import axios, { CancelToken, AxiosResponse } from 'axios'
|
||||
import { toast } from 'react-toastify'
|
||||
import isUrl from 'is-url-superb'
|
||||
import {
|
||||
MetadataMarket,
|
||||
MetadataPublishFormDataset,
|
||||
@ -157,7 +158,7 @@ async function isDockerHubImageValid(
|
||||
|
||||
async function is3rdPartyImageValid(imageURL: string): Promise<boolean> {
|
||||
try {
|
||||
const response = await axios.options(imageURL)
|
||||
const response = await axios.head(imageURL)
|
||||
if (!response || response.status !== 200) {
|
||||
toast.error(
|
||||
'Could not fetch docker image info. Please check URL and try again'
|
||||
@ -174,19 +175,6 @@ async function is3rdPartyImageValid(imageURL: string): Promise<boolean> {
|
||||
}
|
||||
}
|
||||
|
||||
function isUrl(image: string): boolean {
|
||||
const pattern = new RegExp(
|
||||
'^(https?:\\/\\/)?' +
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' +
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))' +
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' +
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?' +
|
||||
'(\\#[-a-z\\d_]*)?$',
|
||||
'i'
|
||||
)
|
||||
return !!pattern.test(image)
|
||||
}
|
||||
|
||||
export async function validateDockerImage(
|
||||
dockerImage: string,
|
||||
tag: string
|
||||
|
Loading…
x
Reference in New Issue
Block a user