summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-06-10 10:45:23 +0200
committerAndras Timar <andras.timar@collabora.com>2017-07-31 12:03:55 +0200
commit6f70c180772e0adaf22823da18bdf90f295879ca (patch)
treec67c6637ce303a83c0eb2ad71f365efb2d2041ad
parentd82a01903f9fcd454f94e25544cc7a1dc0757f96 (diff)
tdf#97743: mediawiki account
To find main url in header section, search link containing: - load.php - or opensearch_desc.php In Wikipedia or wiki.documentfoundation.org, I haven't seen any link with index.php Change-Id: Iccb27aa8aaaf936faf8ec3b3f67eaa98d0426f19 Reviewed-on: https://gerrit.libreoffice.org/38631 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> (cherry picked from commit e34b02834b24be4062ffd535aa1b929481ff427e) Reviewed-on: https://gerrit.libreoffice.org/38646 (cherry picked from commit c51e789b3a5b77b8bca03c3404699655b19ac80d)
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
index 4ef08950c11b..114709fae36e 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
@@ -103,13 +103,16 @@ public class EditPageParser extends HTMLEditorKit.ParserCallback
String sName = ( String ) a.getAttribute( HTML.Attribute.HREF );
if ( sName != null )
{
- int nIndexStart = sName.indexOf( "index.php" );
- // get the main URL from the first header-link with index.php
- // the link with "action=edit" inside is preferable
- if ( nIndexStart>= 0
- && ( m_sMainURL.length() == 0 || sName.contains("action=edit") ) )
+ // get the main URL from the first header-link with load.php (which is used for stylesheet)
+ int nPhpFileStart = sName.indexOf( "load.php" );
+ if (nPhpFileStart < 0)
+ // if not found, try header-link with opensearch_desc.php
+ nPhpFileStart = sName.indexOf( "opensearch_desc.php" );
+
+ if ( nPhpFileStart >= 0
+ && m_sMainURL.length() == 0 )
{
- m_sMainURL = sName.substring( 0, nIndexStart );
+ m_sMainURL = sName.substring( 0, nPhpFileStart );
}
}
}