Commit f26c09c2 authored by liujiaxin's avatar liujiaxin

fix: url regex

parent 523b0892
......@@ -389,7 +389,7 @@ export default class Cartoon {
playAudio(audio_url, cb = null) {
return new Promise((resolve, reject)=>{
if (audio_url) {
var urlreg=/^(?=^.{3,255}$)(http(s)?:\/\/)?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w+\.\w+)*([\?&]\w+=\w*)*$/
var urlreg=/^(?=^.{3,255}$)(http(s)?:\/\/)?(www\.)?[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+(:\d+)*(\/\w+\.\w+)*([\?&]\w+=\w*)*/
if(urlreg.test(audio_url)) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
if(cb) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment