moxiecode / moxie

Pollyfills for XHR2 and File API
GNU Affero General Public License v3.0
486 stars 135 forks source link

In IPv6 environment, it is impossible to upload files normally #184

Open xtayfhvk opened 5 years ago

xtayfhvk commented 5 years ago

Version V1.2.1 used now

Problem phenomenon

Uncaught DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL at i.send (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:14:25918) at i.exec (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:13:22627) at i.shimExec (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:13:23706) at i.exec (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:13:23839) at r (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:14:4154) at h.u (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:14:4632) at h.send (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:14:8087) at p (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:28:10056) at o.Uploader.k (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:28:10957) at o.Uploader. (https://[fec0:16::172:16:98:246]/static/common/ju/plupload.full.min.js?36fada25:28:14560)

source code regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]):?([^:@]))?@)?([^:\/?#])(?::(\d))?))?()(?:(()(?:(?:[^?#\/]\/))()(?:[^?#]))(?:\?([^#]))?(?:#(.*))?)/

Modified code

regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]):?([^:@]))?@)?([^\/?#])(?::(\d))?))?()(?:(()(?:(?:[^?#\/]\/))()(?:[^?#]))(?:\?([^#]))?(?:#(.*))?)/

Where to modify, capture 6 in the regular expression. ([^:\/?#]) --> ([^\/?#])

The first time you submit a problem, if it has been fixed in another version, please ignore the problem. Thank you.