Changeset 13457 in josm for trunk


Ignore:
Timestamp:
2018-02-25T01:21:11+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #15985 - fix handling of relative links in help browser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r13447 r13457  
    1818import java.nio.charset.StandardCharsets;
    1919import java.util.Locale;
     20import java.util.regex.Matcher;
     21import java.util.regex.Pattern;
    2022
    2123import javax.swing.AbstractAction;
     
    617619                return null;
    618620            String s = (String) value;
    619             if (s.matches("#.*"))
    620                 return s.substring(1);
     621            Matcher m = Pattern.compile("(?:"+url+")?#(.+)").matcher(s);
     622            if (m.matches())
     623                return m.group(1);
    621624            return null;
    622625        }
     
    639642                } else {
    640643                    HelpAwareOptionPane.showOptionDialog(
    641                             Main.parent,
     644                            instance,
    642645                            tr("Failed to open help page. The target URL is empty."),
    643646                            tr("Failed to open help page"),
Note: See TracChangeset for help on using the changeset viewer.