apache / apache/grails-core

Render template with relative paths work in dev but not in prod

Open
#14,208 0 comments 0 reactions 0 assignees View on GitHub
relates-to: grails-gsp
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

A view uses a template that is on a different folder (that part is reused by many other views).

### Steps to Reproduce

This worked in prod and in dev in Grails 3.x

In Grails 5.x dev that works, but in prod that doesn't work:

```
org.grails.taglib.GrailsTagException: [views/versionedActor/show.gsp:101] Template not found for name [../version/versionRow] and path [/_version/versionRow.gsp]
at org.grails.gsp.GroovyPage.throwRootCause(GroovyPage.java:469)
at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:415)
at jdk.internal.reflect.GeneratedMethodAccessor641.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:362)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:171)
at gsp_EHRServerNG_versionedActorshow_gsp$_run_closure2.doCall(gsp_EHRServerNG_versionedActorshow_gsp.groovy:53)

```

In Grails 5.x prod this works: (this is correctly documented as / will be resolved against the views folder)

What I think is inconsistent is that in dev it works and not in prod. In fact I detected the issue in prod which is not ideal.

### Expected Behaviour

Just to have a consistent dev and prod behavior.

### Actual Behaviour

Inconsistent dev and prod behavior.

### Environment Information

- **Operating System**: Linux Mint
- **Grails Version:** 5.3.2
- **JDK Version:** 11.0.10

Contributor guide

Open the contributing guide

Research direction

Start at views/versionedActor/show.gsp:101 and inspect how the Grails render tag resolves the relative template ../version/versionRow in development and production. Compare that behavior with the documented absolute /version/versionRow form in Grails 5.3.2; done means relative template paths resolve consistently in both environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.