Wicket
  1. Wicket
  2. WICKET-1755

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.4-M3
    • Fix Version/s: 1.3.5, 1.4-RC1
    • Component/s: wicket
    • Labels:
      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*/ }

      ...

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            uygar yuzsuren
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development