Link to full Medium URL on error page

Previously the link on the error page was only linking to the path
component of the url, e.g. `/search` but ignoring any query params e.g.
`/search?q=hello`. This uses the HTTP::Request `resource` method which
appears to capture both.
This commit is contained in:
Edward Loveall 2022-02-13 10:11:45 -05:00
parent 24d3ab9ab3
commit 1f517f9031
No known key found for this signature in database
GPG Key ID: A7606DFEC2BA731F
3 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
2022-02-13
* Better article ID parsing
* Link to full Medium URL on error page
2022-02-12

View File

@ -12,8 +12,8 @@ class Articles::Show < BrowserAction
html(
Errors::ParseErrorPage,
message: "Error parsing the URL",
status_code: 500,
original_path: request.path,
status_code: 422,
original_resource: request.resource,
)
end
end

View File

@ -1,7 +1,7 @@
class Errors::ParseErrorPage < MainLayout
needs message : String
needs status_code : Int32
needs original_path : String
needs original_resource : String
def page_title
"Error"
@ -25,7 +25,7 @@ class Errors::ParseErrorPage < MainLayout
TEXT
para do
text "If you like, you can try visiting "
a "this page on medium.com", href: "https://medium.com#{original_path}"
a "this page on medium.com", href: "https://medium.com#{original_resource}"
end
end
end