Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View Name/ Template Name is truncated when getAbsoluteViewURIInternal() is used #13952

Open
zzzyy opened this issue Jan 3, 2025 · 1 comment

Comments

@zzzyy
Copy link

zzzyy commented Jan 3, 2025

Expected Behavior

When groovyPageRenderer.render(view: "index") is used, internally when getAbsoluteViewURIInternal() is used, the full url should be given instead of url with truncated first character of the view page.

Actual Behaviour

instead of getting .../grails-app/views/index.gsp, the getAbsoluteViewURIInternal () is returning .../grails-app/views/ndex.gsp. 'i' is being truncated. Most likely due to the code:
String tmp = viewName.substring(1,viewName.length());

Steps To Reproduce

Try to render a gsp page into HTML using PageRenderer. Here is the snippet:
String html
try{
html = groovyPageRenderer.render(view: "index")
}catch (Exception e){
println "Error "
e.printStackTrace()
}

    the html value is always '' because index is being truncated to ndex

Environment Information

  • mac OS Sonoma 14.7
  • java 17.0.3 temurin
  • grails 6.2.2

Example Application

No response

Version

6.2.2

@jdaugherty
Copy link
Contributor

I'm not able to initially reproduce this. Can you please provide a sample project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants