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

Fix open graph urls for RECAP pdfs #3094

Merged
merged 7 commits into from
Sep 7, 2023

Commits on Sep 4, 2023

  1. fix(opengraph): Override open graph urls for RECAP pdfs

    These are a special case where we redirect opengraph bots to /recap/og-lookup/?file_path=/recap/the/path so that they can get their opengraph content.
    Previously, this page was using the og:url from the base.html template, which doesn't include the query parameters.
    This means that clients who depend on the og:url property for the click action on an opengraph card (e.g. Mastodon) were getting URLs that 404ed when you click the preview card but not the link in
    the content that generated it.
    The og:url would always be `courtlistener.com/recap/og-lookup/` which of course 404s since the query param it's expecting isn't present.
    
    To fix, override the template on recap_document.html.
    Pass an `og_file_path` argument when we do the redirect and check for it in the template.
    nathreed committed Sep 4, 2023
    Configuration menu
    Copy the full SHA
    09ba479 View commit details
    Browse the repository at this point in the history
  2. Fix test

    Can't reverse for view attachments with og_file_path param.
    Need to look more closely at getting correct og:url for attachments.
    nathreed committed Sep 4, 2023
    Configuration menu
    Copy the full SHA
    7d28ad6 View commit details
    Browse the repository at this point in the history
  3. Use filepath_local for og url

    This way it will work when we redirect to the first attachment as well as the regular case.
    nathreed committed Sep 4, 2023
    Configuration menu
    Copy the full SHA
    4cdcf3f View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2023

  1. Configuration menu
    Copy the full SHA
    4e84ddc View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2023

  1. Only override og:url if we're serving a redirected og crawler

    is_og_bot will be false normally and only true when view_recap_document is invoked via redirect_og_lookup.
    If false, None will be sent to the template and will use og:url value from base.html template.
    nathreed committed Sep 6, 2023
    Configuration menu
    Copy the full SHA
    a912ad9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8083bae View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2023

  1. Configuration menu
    Copy the full SHA
    9b97802 View commit details
    Browse the repository at this point in the history