MIT-LCP / physionet-build

The new PhysioNet platform.
https://physionet.org/
BSD 3-Clause "New" or "Revised" License
56 stars 20 forks source link

Link to report missing URL on 404 page fails to get the URL #2296

Closed tompollard closed 1 month ago

tompollard commented 1 month ago

We fairly regularly receive the following email:

Date: September 20, 2024 at 2:30:31 AM EDT
To: [EMAIL](mailto:EMAIL)
Subject: Missing URL on <SITENAME>

Dear <SITENAME> Team,

The following URL is missing from the website:

@bemoody pointed out that these emails are generated by people coming across a 404 error page and then clicking the text saying:

If you think this is an error, please email us at: <EMAIL ADDRESS>

The email is pre-populated with text, but the function that is supposed to get the URL fails.

tompollard commented 1 month ago

The issue is with the request.get_raw_uri call in this chunk:

https://github.com/MIT-LCP/physionet-build/blob/93ad99ae01db7748ccbf917bd7339cb1ff541db0/physionet-django/templates/404.html#L14-L21

According to the Django Release Notes at https://django.readthedocs.io/en/stable/releases/4.0.html:

The undocumented HttpRequest.get_raw_uri() method is removed. The HttpRequest.build_absolute_uri() method may be a suitable alternative.

tompollard commented 1 month ago

@rafgia please could you take a look at this issue?

rafgia commented 1 month ago

@tompollard I've changed the function in 404.html file.

tompollard commented 1 month ago

That was quick, thanks @rafgia! Please could you open a pull request with the change? Let me know if it would be helpful to walk through the process of opening a pull request together.

rafgia commented 1 month ago

Yes, it might be better to do this operation together, whenever you have time. Thank you @tompollard !