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

Embedding group page with invalid URL raises error #9355

Closed
mkllnk opened this issue Jun 27, 2022 · 0 comments · Fixed by #9407
Closed

Embedding group page with invalid URL raises error #9355

mkllnk opened this issue Jun 27, 2022 · 0 comments · Fixed by #9407
Labels
bug-s5 We can live with it... Few users are impacted. bugsnag good first issue

Comments

@mkllnk
Copy link
Member

mkllnk commented Jun 27, 2022

Description

The groups page is checking the browser supplied referer header but expects it to be a valid URI. Apparently, sometimes it's not valid and then the page is inaccessible.

Expected Behavior

The page still shows.

Actual Behaviour

A snail is shown.

Steps to Reproduce

I was unable to reproduce this because my browsers (Firefox and Chrome) corrected the URL automatically.

Animated Gif/Screenshot

Workaround

Link to the group page with the correct link.

Severity

bug-s5: we can live with it, only a few users impacted

Your Environment

  • Version used: v4.2.0
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

At a rescue statement:

def current_referer
return if @request.referer.blank?
uri = URI(@request.referer)
return if uri.host.blank?
uri.host.downcase
end

Error in OpenFoodNetwork Aus

URI::InvalidURIError in groups#show
bad URI(is not URI?): "https://www.openfoodnetwork.org.au/groups/6##hubs"

View on Bugsnag

Stacktrace

app/services/embedded_page_service.rb:73 - current_referer
app/services/embedded_page_service.rb:29 - embeddable?
app/services/embedded_page_service.rb:19 - embed!
app/controllers/concerns/embedded_pages.rb:25 - embed_service
app/controllers/concerns/embedded_pages.rb:17 - enable_embedded_pages
lib/session_cookie_upgrader.rb:19 - call

View full stacktrace

Created by Maikel via Bugsnag

@mkllnk mkllnk added the bugsnag label Jun 27, 2022
@mkllnk mkllnk changed the title URI::InvalidURIError in groups#show Embedding group page with invalid URL raises error Jun 27, 2022
@mkllnk mkllnk added bug-s5 We can live with it... Few users are impacted. good first issue labels Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s5 We can live with it... Few users are impacted. bugsnag good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant