SquareSquash/web

Error when clicking on an occurrence item to see more detail

Opened this issue · 2 comments

To replicate:
Click on a bug, then "occurrences" tab. Then click on one of the occurrence items. See below for the error trace.

ActionView::Template::Error (bad component(expected fragment component): #/):
     98:       def other_occurrence_info
     99:         if @occurrence.web?
    100:           h5 "Request"
    101:           pre "#{@occurrence.request_method} #{@occurrence.url.to_s}", class: 'scrollable'
    102:         end
    103:       end
    104:
  app/models/occurrence.rb:510:in `url'
  app/views/occurrences/show.html.rb:101:in `other_occurrence_info'
  app/views/occurrences/show.html.rb:53:in `block in body_content'
  app/views/layouts/application.html.rb:49:in `block (4 levels) in full_width_section'
  app/views/layouts/application.html.rb:49:in `block (3 levels) in full_width_section'
  app/views/layouts/application.html.rb:49:in `block (2 levels) in full_width_section'
  app/views/layouts/application.html.rb:48:in `block in full_width_section'
  app/views/layouts/application.html.rb:47:in `full_width_section'
  app/views/occurrences/show.html.rb:34:in `body_content'
  app/views/layouts/application.html.rb:161:in `block in body_portion'
  app/views/layouts/application.html.rb:148:in `body_portion'
  app/views/layouts/application.html.rb:27:in `block in content'
  app/views/layouts/application.html.rb:25:in `content'
  app/views/occurrences/show.html.rb:1:in `_app_views_occurrences_show_html_rb__1648341601887724721_70129514060960'
  app/controllers/occurrences_controller.rb:242:in `show'

Removing "fragments" in models/occurrence.rb (line 510) seems to fix it.
ie) change

URI.scheme_list[schema.upcase].build(host: host, port: port, path: path, query: query, fragment: fragment)

to

URI.scheme_list[schema.upcase].build(host: host, port: port, path: path, query: query)

OK, I don't know why the Ruby URI class seems to believe that / is an invalid fragment name, but I probably need a more liberal URL parser.

The invalid fragment is not /, but rather, #/, which does indeed look invalid. The problem seems to be that '#' was leaked into the fragment somehow, not that the URI parser is misbehaving.