ItSpiderman has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/337559 )

Change subject: Fix for error on inserting wrong link in InsertLink dialog
......................................................................

Fix for error on inserting wrong link in InsertLink dialog

When user enters a link with section identifier (#) or ?, & and clicks OK,
dialog crashes, because no valid title is being selected. This is a simple
fix to prevent such unlikely events.

I tried to make it actualy work, to be able to get valid title even from
link that contains wrong characters, but it will take some time. If anyone
thinks that it would be good to do, I will be happy to refactor it!

Needs cherry-picking to REL1_27 and master

Change-Id: Ia120b14c3c1d715fbc10e0326ee73fd46a9bbbe7
---
M InsertLink/resources/BS.InsertLink/FormPanelWikiPage.js
M InsertLink/resources/bluespice.insertLink.js
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/59/337559/1

diff --git a/InsertLink/resources/BS.InsertLink/FormPanelWikiPage.js 
b/InsertLink/resources/BS.InsertLink/FormPanelWikiPage.js
index a6f5c72..af63ef0 100644
--- a/InsertLink/resources/BS.InsertLink/FormPanelWikiPage.js
+++ b/InsertLink/resources/BS.InsertLink/FormPanelWikiPage.js
@@ -99,13 +99,16 @@
        },
        getData: function() {
                var title = this.callParent();
-
                var desc = '';
                if ( title !== '' ) {
                        desc = '|'+title;
                }
 
                var value = this.cbPageName.getValue();
+
+               if( !value ) {
+                       return null;
+               }
 
                var text = value.getPrefixedText();
 
@@ -130,4 +133,4 @@
        getDescription: function() {
                return this.callParent();
        }
-});
\ No newline at end of file
+});
diff --git a/InsertLink/resources/bluespice.insertLink.js 
b/InsertLink/resources/bluespice.insertLink.js
index 41ce6ae..bf50d5c 100644
--- a/InsertLink/resources/bluespice.insertLink.js
+++ b/InsertLink/resources/bluespice.insertLink.js
@@ -171,6 +171,8 @@
                return data;
        },
        applyData: function(window, data, plugin) {
+               if( !data ) return;
+
                var editor = plugin.getEditor();
                
editor.selection.moveToBookmark(BsInsertLinkVisualEditorConnector.bookmark);
                editor.focus();
@@ -226,4 +228,4 @@
                //editor.selection.select(newAnchor, false);
                //editor.selection.collapse(false);
        }
-};
\ No newline at end of file
+};

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia120b14c3c1d715fbc10e0326ee73fd46a9bbbe7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: REL1_23
Gerrit-Owner: ItSpiderman <[email protected]>

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

Reply via email to