@tarojs/runtime 4.0.0-alpha.36 → 4.0.0-alpha.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -427,11 +427,19 @@ const URLSearchParams = process.env.TARO_PLATFORM === 'web' ? env.window.URLSear
427
427
  for (let pairs = query.split('&'), i = 0, length = pairs.length; i < length; i++) {
428
428
  const value = pairs[i];
429
429
  const index = value.indexOf('=');
430
- if (index > -1) {
431
- appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
430
+ // 针对不规范的 url 参数做容错处理,如:word=你%好
431
+ try {
432
+ if (index > -1) {
433
+ appendTo(dict, decode(value.slice(0, index)), decode(value.slice(index + 1)));
434
+ }
435
+ else if (value.length) {
436
+ appendTo(dict, decode(value), '');
437
+ }
432
438
  }
433
- else if (value.length) {
434
- appendTo(dict, decode(value), '');
439
+ catch (err) {
440
+ if (process.env.NODE_ENV !== 'production') {
441
+ console.warn(`[Taro warn] URL 参数 ${value} decode 异常`);
442
+ }
435
443
  }
436
444
  }
437
445
  }