Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/231707

Change subject: WikiConfig: sensible defaults for hasValidProtocol / 
findValidProtocol
......................................................................

WikiConfig: sensible defaults for hasValidProtocol / findValidProtocol

These match VisualEditor's defaults in "standalone" mode, so they're
reasonable defaults for Parsoid as well.

Change-Id: I06e23f90d2892723cb3442cf4fbaaaf75556084c
---
M lib/mediawiki.WikiConfig.js
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/07/231707/1

diff --git a/lib/mediawiki.WikiConfig.js b/lib/mediawiki.WikiConfig.js
index 6e2184a..e3f335f 100644
--- a/lib/mediawiki.WikiConfig.js
+++ b/lib/mediawiki.WikiConfig.js
@@ -688,8 +688,8 @@
        if (this._anchoredProtocolRegex) {
                return this._anchoredProtocolRegex.test(potentialLink);
        } else {
-               // With no available restrictions, we have to assume "no".
-               return false;
+               // If no configuration is loaded, just look for http/https
+               return /^(https?:\/\/)/i.test(potentialLink);
        }
 };
 
@@ -701,8 +701,8 @@
        if (this._unanchoredProtocolRegex) {
                return this._unanchoredProtocolRegex.exec(potentialLink);
        } else {
-               // With no available restrictions, we have to assume "no".
-               return null;
+               // If no configuration is loaded, just look for http/https
+               return /(?:\W|^)(https?:\/\/)/i.exec(potentialLink);
        }
 };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/231707
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I06e23f90d2892723cb3442cf4fbaaaf75556084c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to