Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-16019

Wiki Creation name check fails in specific case

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 10.8
    • Wiki
    • None
    • Windows, Apache, DELL Authentication Proxy Server
    • Unknown

    Description

      In a specific case where the wiki is installed on windows behind a single sign on proxy server and an apache server, the wiki creation screen is always refusing the name of the wiki as already used.

      After investigation, it has been found that the page

      https://xxxx/xwiki/bin/view/WikiManager/IsWikiOrDatabaseOrAvailableService?xpage=plain&outputSyntax=plain&ajax=1&wikiname=testname&form_token=idF2y3OQVniLcaufF7CyXQ

      Returns "true" followed by 218 white characters. When contacting the server directly this does not happen. It is unclear which system is adding the characters and it is not clear if this is a valid behavior using HTTP.

      The problem was workedaround using a trim() in the javascript checking the value in this function

       function validateWikiName(){
          var wikiNameElement = $('wikiname');
          var wikiname = wikiNameElement.value;
          var filteredWikiName = filterWikiName(wikiname);
          if (wikiname != filteredWikiName) {
            wikiNameElement.value = filteredWikiName;
            wikiname = filteredWikiName;
          }
          if (lastWikiName == wikiname){
            return;
          }
          lastWikiName = wikiname;
          if (wikiname && !wikiname.blank()) {
            var surl = "$ISWIKINAMEAVAILABLE" + "?xpage=plain&outputSyntax=plain&ajax=1&wikiname=" + escape(wikiname);
            surl += "&form_token=$!{services.csrf.getToken()}";
            new Ajax.Request(surl, {
              method: 'get',
              onSuccess: function(transport) {
                if (transport.responseText.trim() == "true") {
                  $('wikinamevalidation').innerHTML = "";
                  wikiNameElement.removeClassName('xErrorField');
                    if (!$('prettyname').value.blank()) {
                      $('wizard-next').disabled = false;
                    }
                }
                else if (transport.responseText.trim() == "database"){
                  $('wikinamevalidation').innerHTML = "$MSG_ERROR_DATABASEALREADYEXISTS";
                  wikiNameElement.addClassName('xErrorField');
                  $('wizard-next').disabled = true;
                }
                else if (transport.responseText.trim() == "wiki"){
                  $('wikinamevalidation').innerHTML = "$MSG_ERROR_WIKIALREADYEXISTS";
                  wikiNameElement.addClassName('xErrorField');
                  $('wizard-next').disabled = true;
                }
                else{
                  $('wikinamevalidation').innerHTML = "$MSG_ERROR_WIKINAMEALREADYUSED";
                  wikiNameElement.addClassName('xErrorField');
                  $('wizard-next').disabled = true;
                }
              }
            });
          }
          else{
            $('wikinamevalidation').innerHTML = "$MSG_ERROR_WIKINAMEEMPTY";
            $('wizard-next').disabled = true;
          }
        }
      

      It seems we might want to toughen a bit the check of the return of such HTTP either by using JSON or by considering that we could receive more data than the text sent by our XWiki code.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ludovic Ludovic Dubost
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: