jamesfredley commented on issue #14282: URL: https://github.com/apache/grails-core/issues/14282#issuecomment-5944820194
Fixed on `8.0.x`. When a namespaced JSON view path did not start with `/`, `GenericGroovyTemplateResolver.resolveTemplateName` always executed `path.substring(1)`. `v1/message/index.gson` became `1/message/index.gson`, so the precompiled class name did not match the lookup. `run-app`, and a WAR launched from the project directory, still found the source template. A WAR launched from anywhere else only had the precompiled class and failed with `Could not resolve view with name 'index'`. The leading character is now removed only when the path starts with `/` or a file separator (`GenericGroovyTemplateResolver.groovy`, `resolveTemplateName`). That is commit d7903e1aa3 (2020-07-05, "fixing path substring stripping out build classpaths"), the change noted on this issue the same day. eb59bf078e (2020-09-04) also checks `File.separator`. The commit is in the grails-views 2.1.0 milestones (`v2.1.0.M2` through `v2.1.0-RC4`), in the 7.0.0 through 7.2.4 tags except `v7.0.16`, and in `v8.0.0-M1` through `v8.0.0-RC2`. Closing as fixed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
