≡

wincent.dev

  • Products
  • Blog
  • Wiki
  • Issues
You are viewing an historical archive of past issues. Please report new issues to the appropriate project issue tracker on GitHub.
Home » Issues » Bug #1410

Bug #1410: Commenting on wiki articles with periods in the titles, blog posts with periods in permalink, leads to 404 (RoutingError)

Kind bug
Product wincent.dev
When Created 2009-09-16T16:15:50Z, updated 2009-09-17T06:17:11Z
Status closed
Reporter Greg Hurrell
Tags no tags

Description

Think this is new breakage. Happens for both logged-in and logged-out users. Just tried it on "Installing GnuPG on Mac OS X 10.6 Snow Leopard". Not sure yet if it happens only for some articles (like ones with periods in the title) or all. My suspicion is the former.

Comments

  1. Greg Hurrell 2009-09-16T16:20:50Z

    Yep, local testing confirms that it's the dot in the article name. Yields a routing error.

  2. Greg Hurrell 2009-09-16T16:21:01Z

    Summary changed:

    • From: Commenting on wiki articles leads to 404
    • To: Commenting on wiki articles with periods in the titles leads to 404
  3. Greg Hurrell 2009-09-16T16:21:09Z

    Summary changed:

    • From: Commenting on wiki articles with periods in the titles leads to 404
    • To: Commenting on wiki articles with periods in the titles leads to 404 (RoutingError)
  4. Greg Hurrell 2009-09-16T16:23:49Z

    Sigh, this may not be straightforward to fix. The routing defined in config/routes.rb looks correct to me at first glance:

      map.resources :articles,
                    :as => :wiki,
                    :requirements => { :id => /[^\/]+/, :protocol => 'https' },
                    :has_many => [ :comments ]

    The requirements don't seem to "trickle down" to the nested part of the association.

  5. Greg Hurrell 2009-09-16T16:27:13Z

    Might try rewriting it as:

    map.resources :articles, :as => :wiki, :requirements => { :id => /[^\/]+/, :protocol => 'https' } do |articles|
      articles.resources :comments
    end

    Should be equivalent, but might not be affected by the bug...

  6. Greg Hurrell 2009-09-16T16:34:48Z

    As expected, same problem affects blog posts with periods in permalink.

  7. Greg Hurrell 2009-09-16T16:35:04Z

    Summary changed:

    • From: Commenting on wiki articles with periods in the titles leads to 404 (RoutingError)
    • To: Commenting on wiki articles with periods in the titles, blog posts with periods in permalink, leads to 404 (RoutingError)
  8. Greg Hurrell 2009-09-16T16:36:33Z

    Unfortunately rewriting it doesn't work. Looks like a Rails routing bug to me. Will dig deeper.

  9. Greg Hurrell Created 2009-09-16T17:47:20Z, edited 2009-09-17T03:10:42Z

    Ok, found the workaround. Pretty ugly, but works:

    map.resources :articles, :as => :wiki, :requirements => { :id => /[^\/]+/, :protocol => 'https' } do |articles|
      articles.resources :comments, :requirements => { :article_id => /[^\/]+/, :protocol => 'https' }
    end

    The fact that you have to do it this way is definitely a design wart, if not a bug, but at least we have a workaround.

  10. Greg Hurrell 2009-09-17T03:10:57Z

    Ok, fixed it for blog posts as well.

  11. Greg Hurrell 2009-09-17T06:17:05Z

    Ok, this is now deployed. Will mark as closed.

  12. Greg Hurrell 2009-09-17T06:17:11Z

    Status changed:

    • From: new
    • To: closed
Add a comment

Comments are now closed for this issue.

  • contact
  • legal

Menu

  • Blog
  • Wiki
  • Issues
  • Snippets