Changeset 547


Ignore:
Timestamp:
11/27/13 16:41:14 (10 years ago)
Author:
jts21
Message:

Fix bugs in URL validation logic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/widgets/JfxBrowser.java

    r546 r547  
    295295                        int firstSlash = url.indexOf('/');
    296296                        int firstQuestion = url.indexOf('?');
    297                         if(firstDot == -1 ||                                        // no '.' and no protocol -> search
    298                                 (firstSpace != -1 && firstSpace <= firstDot + 1) || // ' ' before '.'         -> search
    299                                 (firstSlash == -1 && firstQuestion == -1)) {        // no '/' or '?'          -> search
     297                        int firstSQ;
     298                        if(firstSlash == -1) {
     299                                firstSQ = firstQuestion;
     300                        } else if(firstQuestion == -1) {
     301                                firstSQ = firstSlash;
     302                        } else {
     303                                firstSQ = -1;
     304                        }
     305                        if(firstDot <= 0 ||                                        // no '.' or starts with '.' -> search
     306                                (firstSpace != -1 && firstSpace < firstDot + 1) || // ' ' before '.'            -> search
     307                                (firstSpace != -1 && firstSpace < firstSQ)) {      // no '/' or '?'             -> search
    300308                                // make it a search
    301309                                actualURL = UserSettings.searchEngine + url;
Note: See TracChangeset for help on using the changeset viewer.