Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-3145

Double encoding in URI with slash and hypen in DB name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0, 1.7.0
    • None
    • Fauxton
    • None

    Description

      When creating database with hyphen and slash in its name, Fauxten cant list this name in list all DB ( _all_dbs ).
      If DB name with only hyphen or slash - ewerithing is OK.

      In log list all DBs looks like this:

      [notice] 2016-09-13T08:16:21.343173Z couchdb@localhost <0.11290.0> 23a0d97781 X.X.X.X:5984 Y.Y.Y.Y admin GET /all_dbs?=1473754580639 200 ok 3
      [notice] 2016-09-13T08:16:21.470890Z couchdb@localhost <0.11290.0> bd26963777 X.X.X.X:5984 Y.Y.Y.Y admin GET /_global_changes 200 ok 2
      [notice] 2016-09-13T08:16:21.471687Z couchdb@localhost <0.10814.0> b30d1037bf X.X.X.X:5984 Y.Y.Y.Y admin GET /_metadata 200 ok 2
      [notice] 2016-09-13T08:16:21.473135Z couchdb@localhost <0.10833.0> d00c53a85d X.X.X.X:5984 Y.Y.Y.Y admin GET /_replicator 200 ok 2
      [notice] 2016-09-13T08:16:21.474227Z couchdb@localhost <0.11068.0> 7916c73be5 X.X.X.X:5984 Y.Y.Y.Y admin GET /_users 200 ok 2
      [notice] 2016-09-13T08:16:21.475637Z couchdb@localhost <0.10816.0> addcc98b40 X.X.X.X:5984 Y.Y.Y.Y admin GET /test- 200 ok 2
      [notice] 2016-09-13T08:16:21.476310Z couchdb@localhost <0.10815.0> 578f9f27d2 X.X.X.X:5984 Y.Y.Y.Y undefined GET /test-%252F- 404 ok 1
      [notice] 2016-09-13T08:16:21.531812Z couchdb@localhost <0.10814.0> 618f84d6df X.X.X.X:5984 Y.Y.Y.Y admin GET /test%2F 200 ok 2
      [notice] 2016-09-13T08:16:21.534608Z couchdb@localhost <0.10833.0> 70e91d0260 X.X.X.X:5984 Y.Y.Y.Y admin GET /test%2Ftest%2Ftest 200 ok 2

      Fauxton try GET /test-%252F- not /test-%2F-
      So its call encodeURIComponent() twice on this type of URI and on second run its encode % to %25 ( / --> %2F --> %252F )

      I beleive bug in "app/core/utils.js" in function "utils.safeURLName()":

        safeURLName: function (name) {
          var testName = name || "";
          var checkforBad = testName.match(/[\$\-/,+-]/g);
          return (checkforBad !== null) ? encodeURIComponent(name) : name;
        },
      

      If remove all hyphens from

      /[\$\-/,+-]/g

      then DB list correctly.

      Attachments

        Activity

          People

            Unassigned Unassigned
            skor Sergey Korobkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: