Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1755

In html Include component isAbsolute method returns false for an absolute path in unix-like systems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.4-M3
    • 1.3.5, 1.4-RC1
    • wicket
    • None

    Description

      In isAbsolute method, if colon position is -1 then this url MAY STILL be an absolute url. In unix systems there may not be colon in absolute paths. For example: /home/someuser.somefile.html

      So, in order to fix this, a leading / (slash) may be checked to exist like:

      int colonPos = url.indexOf(":");
      int slashPos = url.indexOf("/");

      if (colonPos == -1 && slashPos == -1) {
      return false; //Relative
      } else if (colonPos == -1 && slashPos == 0) {
      return true; //Absolute
      }

      //Original Code
      //org.apache.wicket.markup.html.include.Include.java

      protected final boolean isAbsolute(String url)
      {
      if (url == null)

      { return false; }

      // do a fast, simple check first
      int colonPos;
      if ((colonPos = url.indexOf(":")) == -1)

      { return false; /*PROBLEM IS HERE*/ }

      ...

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            uygaryuzsuren uygar yuzsuren
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: