Quantcast

Bug? UrlMappings param containing dot "." in URL get chopped

classic Classic list List threaded Threaded
7 messages Options
ev0
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Bug? UrlMappings param containing dot "." in URL get chopped

ev0
Hi,

I just found that if a parameter as defined in UrlMappings contains a dot character ("."), the param value received by the controller will get chopped at the position of the dot.

e.g.
#UrlMappings.groovy
"/tags/$tag/$max?/$offset?"{
          controller='feed'
          action='tags'
          constraints{
              tag(matches://)
              max(matches:/\d+/)
              offset(matches:/\d+/)
          }
      }

The URL can be: http://my.site/tags/web2.0

Then in the controller, the actual param received becomes "web2", instead of "web2.0".

Has anyone encountered such a problem too? It looks like a bug with UrlMappings.

--
Best Regards,
Damien
ev0
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Bug? UrlMappings param containing dot "." in URL get chopped

ev0
Forgot to mention this. This only happens when the $tag param is the last one in the URL. So my current workaround is to always append the $max param after it.

On Fri, Mar 28, 2008 at 1:34 PM, Damien Hou <[hidden email]> wrote:
Hi,

I just found that if a parameter as defined in UrlMappings contains a dot character ("."), the param value received by the controller will get chopped at the position of the dot.

e.g.
#UrlMappings.groovy
"/tags/$tag/$max?/$offset?"{
          controller='feed'
          action='tags'
          constraints{
              tag(matches://)
              max(matches:/\d+/)
              offset(matches:/\d+/)
          }
      }

The URL can be: http://my.site/tags/web2.0

Then in the controller, the actual param received becomes "web2", instead of "web2.0".

Has anyone encountered such a problem too? It looks like a bug with UrlMappings.

--
Best Regards,
Damien



--
Best Regards,
Damien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Bug? UrlMappings param containing dot "." in URL get chopped

houbie
In reply to this post by ev0
I had the same problem and found out that this actualy is a feature. In fact this only happens with params at the end of the url because it's considered as a file extension (used for content negotiation).
If you set grails.mime.file.extensions to false in Config.groovy, the file extensions won't get chopped of anymore.

ev0 wrote
I just found that if a parameter as defined in UrlMappings contains a dot
character ("."), the param value received by the controller will get chopped
at the position of the dot.
ev0
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Bug? UrlMappings param containing dot "." in URL get chopped

ev0
Ah yes. I can see that now. Thanks for mentioning! I'm using URI extension content negotiation somewhere else in my code actually.

Then I think the feature could be given some tweaks. Like limiting the valid extensions using syntax similar to UrlMappings. That means only recognized format, say, ".xml, .json", will be treated as content negotiation params. Otherwise it's just plain URL. Or, in a DRY way, only enable negotiation for those defined in "grails.mime.types".

What do you guys think?


On Fri, Mar 28, 2008 at 3:17 PM, houbie <[hidden email]> wrote:

I had the same problem and found out that this actualy is a feature. In fact
this only happens with params at the end of the url because it's considered
as a file extension (used for content negotiation).
If you set grails.mime.file.extensions to false in Config.groovy, the file
extensions won't get chopped of anymore.


ev0 wrote:
>
> I just found that if a parameter as defined in UrlMappings contains a dot
> character ("."), the param value received by the controller will get
> chopped
> at the position of the dot.
>

--
View this message in context: http://www.nabble.com/Bug--UrlMappings-param-containing-dot-%22.%22-in-URL-get-chopped-tp16346107p16346978.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best Regards,
Damien
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Bug? UrlMappings param containing dot "." in URL get chopped

Graeme Rocher
Seems reasonable, raise a JIRA

Cheers

On Fri, Mar 28, 2008 at 7:31 AM, Damien Hou <[hidden email]> wrote:

> Ah yes. I can see that now. Thanks for mentioning! I'm using URI extension
> content negotiation somewhere else in my code actually.
>
> Then I think the feature could be given some tweaks. Like limiting the valid
> extensions using syntax similar to UrlMappings. That means only recognized
> format, say, ".xml, .json", will be treated as content negotiation params.
> Otherwise it's just plain URL. Or, in a DRY way, only enable negotiation for
> those defined in "grails.mime.types".
>
> What do you guys think?
>
>
>
>
> On Fri, Mar 28, 2008 at 3:17 PM, houbie <[hidden email]> wrote:
> >
> > I had the same problem and found out that this actualy is a feature. In
> fact
> > this only happens with params at the end of the url because it's
> considered
> > as a file extension (used for content negotiation).
> > If you set grails.mime.file.extensions to false in Config.groovy, the file
> > extensions won't get chopped of anymore.
> >
> >
> >
> > ev0 wrote:
> > >
> > > I just found that if a parameter as defined in UrlMappings contains a
> dot
> > > character ("."), the param value received by the controller will get
> > > chopped
> > > at the position of the dot.
> > >
> >
> > --
> > View this message in context:
> http://www.nabble.com/Bug--UrlMappings-param-containing-dot-%22.%22-in-URL-get-chopped-tp16346107p16346978.html
> > Sent from the grails - user mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >
>
>
>
> --
> Best Regards,
> Damien



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Bug? UrlMappings param containing dot "." in URL get chopped

hippyod
In reply to this post by ev0
+1 for the DRY way

ev0 wrote
Ah yes. I can see that now. Thanks for mentioning! I'm using URI extension
content negotiation somewhere else in my code actually.

Then I think the feature could be given some tweaks. Like limiting the valid
extensions using syntax similar to UrlMappings. That means only recognized
format, say, ".xml, .json", will be treated as content negotiation params.
Otherwise it's just plain URL. Or, in a DRY way, only enable negotiation for
those defined in "grails.mime.types".

What do you guys think?


On Fri, Mar 28, 2008 at 3:17 PM, houbie <ivo@houbrechts-it.be> wrote:

>
> I had the same problem and found out that this actualy is a feature. In
> fact
> this only happens with params at the end of the url because it's
> considered
> as a file extension (used for content negotiation).
> If you set grails.mime.file.extensions to false in Config.groovy, the file
> extensions won't get chopped of anymore.
>
>
> ev0 wrote:
> >
> > I just found that if a parameter as defined in UrlMappings contains a
> dot
> > character ("."), the param value received by the controller will get
> > chopped
> > at the position of the dot.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Bug--UrlMappings-param-containing-dot-%22.%22-in-URL-get-chopped-tp16346107p16346978.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


--
Best Regards,
Damien
ev0
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Bug? UrlMappings param containing dot "." in URL get chopped

ev0
In reply to this post by Graeme Rocher
JIRA created: http://jira.codehaus.org/browse/GRAILS-2740

On Fri, Mar 28, 2008 at 4:49 PM, Graeme Rocher <[hidden email]> wrote:
Seems reasonable, raise a JIRA

Cheers

On Fri, Mar 28, 2008 at 7:31 AM, Damien Hou <[hidden email]> wrote:
> Ah yes. I can see that now. Thanks for mentioning! I'm using URI extension
> content negotiation somewhere else in my code actually.
>
> Then I think the feature could be given some tweaks. Like limiting the valid
> extensions using syntax similar to UrlMappings. That means only recognized
> format, say, ".xml, .json", will be treated as content negotiation params.
> Otherwise it's just plain URL. Or, in a DRY way, only enable negotiation for
> those defined in "grails.mime.types".
>
> What do you guys think?
>
>
>
>
> On Fri, Mar 28, 2008 at 3:17 PM, houbie <[hidden email]> wrote:
> >
> > I had the same problem and found out that this actualy is a feature. In
> fact
> > this only happens with params at the end of the url because it's
> considered
> > as a file extension (used for content negotiation).
> > If you set grails.mime.file.extensions to false in Config.groovy, the file
> > extensions won't get chopped of anymore.
> >
> >
> >
> > ev0 wrote:
> > >
> > > I just found that if a parameter as defined in UrlMappings contains a
> dot
> > > character ("."), the param value received by the controller will get
> > > chopped
> > > at the position of the dot.
> > >
> >
> > --
> > View this message in context:
> http://www.nabble.com/Bug--UrlMappings-param-containing-dot-%22.%22-in-URL-get-chopped-tp16346107p16346978.html
> > Sent from the grails - user mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >
>
>
>
> --
> Best Regards,
> Damien



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Best Regards,
Damien
Loading...