parent
02c4cb52b1
commit
18a9744f96
@ -29,7 +29,9 @@ import {
|
||||
checkUrlForFile,
|
||||
copyTextToClipboard,
|
||||
downloadFile,
|
||||
getFilenameFromUrl
|
||||
getFilenameFromUrl,
|
||||
isReachable,
|
||||
isValidUrl
|
||||
} from '../../utils'
|
||||
import { Comments } from '../../components/comment'
|
||||
import { PublishDetails } from 'components/Internal/PublishDetails'
|
||||
@ -615,11 +617,25 @@ const Download = ({
|
||||
}: DownloadUrl) => {
|
||||
const [showAuthDetails, setShowAuthDetails] = useState(false)
|
||||
const [showNotice, setShowNotice] = useState(false)
|
||||
const showScanNotice = !malwareScanLink
|
||||
const [showScanNotice, setShowCanNotice] = useState(false)
|
||||
|
||||
useDidMount(async () => {
|
||||
const isFile = await checkUrlForFile(url)
|
||||
setShowNotice(!isFile)
|
||||
|
||||
// Check the malware scan url
|
||||
// if it's valid URL
|
||||
// if it's reachable
|
||||
// if it contains sha256
|
||||
const regex = /\b[a-fA-F0-9]{64}\b/
|
||||
setShowCanNotice(
|
||||
!(
|
||||
malwareScanLink &&
|
||||
isValidUrl(malwareScanLink) &&
|
||||
(await isReachable(malwareScanLink)) &&
|
||||
regex.test(url)
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
const handleDownload = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user