Uploaded image for project: 'ColdBox Platform'
  1. COLDBOX-515

Exception handling broken for customErrorTemplate when application relative path used

    Details

    • Type: Bug
    • Status: Verified (View workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.0
    • Component/s: Bootstrapper
    • Labels:
      None
    • Environment:

      coldBox 4.2.0, windows 10, IIS, Adobe CF 11,0,06,295053

      Description

      the docs state: (http://coldbox.ortusbooks.com/content/configuration/coldboxcfc/configuration_directives/coldbox.html)

      customErrroTemplate: (yes, the docs do have this type-o)
      The relative path from the application's root level of where the custom error template exists.

      Therefore, for an application located at '/app', and a custom error at 'views/customError.cfm', the following configuration should work:

          customErrorTemplate = "views/customError.cfm"
      

      but it causes "Could not find the included template views/customError.cfm" at C:/inetpub/wwwroot/coldbox/system/Bootstrap.cfc: line 515


      I believe this is because the processException function in Bootstrap.cfc is first checking if the custom error page exists with expandPath (which looks relative to the base executing page '/app/index.cfm', which is '/app/views/customError.cfm') and finds the file, but then includes the CF template with the include method (which looks relative to the current executing template '/coldbox/system/Bootstrap.cfc', and attempts to load '/coldbox/system/views/customError.cfm') and does not find the file.

      ColdBox 3 would always prepend the appLocation before loading the custom error template and therefore worked because the path then became relative to the site root rather than a template which is consistent between expandPath and include used in components. ColdBox 4 only prepends the appLocation if it does not find the custom error template. Thus a workaround is to prepend the custom error template value with a '/', allowing the fileExists with expandPath to fail and the include call to succeed after the application path is prepended, however, this is not a valid path to the required file (as there is no 'views' directory at the site root) and is not relative to the application as the docs specify it should be. The default value works because it is relative to the site root.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                lmajano Luis Majano
                Reporter:
                BryanHenderson Bryan Henderson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: