you gotta do encodeAsURL for anything in the URL

In testing spotmouth, came across some spots that had ampersands in the names.  I put the names in the URL (heard it's good for seo), but when I did a request for the spot with the ampersand in it, I got a 404.

I needed to call the "encodeAsUrl()" on the values that could contain these types of characters.  here's an example of what I am doing:

 

                 <g:link target="_self" action="spotdetail" id="${item.getFieldValue('spotid_l')}" params="[name:item.getFieldValue('spot_label_s').encodeAsURL()]">
                                      <g:if test="${item.getFieldValue('image_thumbnail_57x57_url_s')}">
                       
                            <img   src="${item.getFieldValue('image_thumbnail_57x57_url_s')}" />

                        </g:if>
                     </g:link>

 

Comments

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options