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

Wiki Creation name check fails in specific case

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.8
    • Fix Version/s: None
    • Component/s: Wiki
    • Labels:
      None
    • Environment:
      Windows, Apache, DELL Authentication Proxy Server
    • Difficulty:
      Unknown
    • Similar issues:

      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

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

              Dates

              • Created:
                Updated: