Uploaded image for project: 'Data Collection, Analytics, and Events'
  1. Data Collection, Analytics, and Events
  2. DCAEGEN2-2452

Deployment Handler adds undefined tenant to deployment links

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Guilin Release
    • Guilin Release
    • None
    • None

      /* Generate self and status links object for responses */
      const createLinks = function(req, deploymentId, executionId) {
       var baseURL = req.protocol + '://' + req.get('Host') + req.app.mountpath + '/' + deploymentId;
          return {
           self: baseURL,
        status: baseURL + '/operation/' + executionId + '?cfy_tenant_name=' + req.query.cfy_tenant_name || DEFAULT_TENANT
       };
      };
      

      issue:

      '?cfy_tenant_name=' + req.query.cfy_tenant_name || DEFAULT_TENANT
      

      Addition operator is evaluated before or ('||') operator resulting in:

      '?cfy_tenant_name=undefined' || DEFAULT_TENANT
      

      meaning it's impossible to assign tenant as value of 'DEFAULT_TENANT'

      proposed solution:

      '?cfy_tenant_name=' + (req.query.cfy_tenant_name || DEFAULT_TENANT)
      

            rjanecze rjanecze
            rjanecze rjanecze
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: