prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  "Report a content problem" gets wrong title
  **Summary**
  You end up on https://github.com/mdn/sprints/issues/new?template=issue-template.md&projects=mdn/sprints/2&labels=user-report&title=%2Fen-US
  
  That prefills the title only to `/en-US`.
  
  
  **Steps To Reproduce (STR)**
  
  1. Go to https://developer.mozilla.org/en-US/docs/Web/JavaScript
  2. Click "Report a content problem" in the "Feedback" menu
  
  
  **Actual behavior**
  GitHub issue form title is just `/en-US`
  
  
  **Expected behavior**
  `/en-US/docs/Web/JavaScript`
  
  
  **Additional context**
  Should it be more than just the document URI?
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kuma/wiki/templatetags/ssr.py`
  Content:
  ```
  1 import json
  2 import os
  3 from functools import lru_cache
  4 
  5 import requests
  6 import requests.exceptions
  7 from django.conf import settings
  8 from django_jinja import library
  9 
  10 
  11 @lru_cache()
  12 def get_localization_data(locale):
  13     """
  14     Read the frontend string catalog for the specified locale, parse
  15     it as JSON, and return the resulting dict. The returned values
  16     are cached so that we don't have to read files all the time.
  17     """
  18     path = os.path.join(settings.BASE_DIR, "static", "jsi18n", locale, "react.json")
  19     with open(path, "r") as f:
  20         return json.load(f)
  21 
  22 
  23 @library.global_function
  24 def render_react(component_name, locale, url, document_data, ssr=True):
  25     """
  26     Render a script tag to define the data and any other HTML tags needed
  27     to enable the display of a React-based UI. By default, this does
  28     server side rendering, falling back to client-side rendering if
  29     the SSR attempt fails. Pass False as the second argument to do
  30     client-side rendering unconditionally.
  31 
  32     Note that we are not defining a generic Jinja template tag here.
  33     The code in this file is specific to Kuma's React-based UI.
  34     """
  35     localization_data = get_localization_data(locale)
  36 
  37     data = {
  38         "locale": locale,
  39         "stringCatalog": localization_data["catalog"],
  40         "pluralExpression": localization_data["plural"],
  41         "url": url,
  42         "documentData": document_data,
  43     }
  44 
  45     if ssr:
  46         return server_side_render(component_name, data)
  47     else:
  48         return client_side_render(component_name, data)
  49 
  50 
  51 def _render(component_name, html, script, needs_serialization=False):
  52     """A utility function used by both client side and server side rendering.
  53     Returns a string that includes the specified HTML and a serialized
  54     form of the state dict, in the format expected by the client-side code
  55     in kuma/javascript/src/index.jsx.
  56     """
  57     if needs_serialization:
  58         assert isinstance(script, dict), type(script)
  59         script = json.dumps(script).replace("</", "<\\/")
  60     else:
  61         script = "JSON.parse({})".format(script)
  62 
  63     return (
  64         '<div id="react-container" data-component-name="{}">{}</div>\n'
  65         "<script>window._react_data = {};</script>\n"
  66     ).format(component_name, html, script)
  67 
  68 
  69 def client_side_render(component_name, data):
  70     """
  71     Output an empty <div> and a script with complete state so that
  72     the UI can be rendered on the client-side.
  73     """
  74     return _render(component_name, "", data, needs_serialization=True)
  75 
  76 
  77 def server_side_render(component_name, data):
  78     """
  79     Pre-render the React UI to HTML and output it in a <div>, and then
  80     also pass the necessary serialized state in a <script> so that
  81     React on the client side can sync itself with the pre-rendred HTML.
  82 
  83     If any exceptions are thrown during the server-side rendering, we
  84     fall back to client-side rendering instead.
  85     """
  86     url = "{}/{}".format(settings.SSR_URL, component_name)
  87     timeout = settings.SSR_TIMEOUT
  88     # Try server side rendering
  89     try:
  90         # POST the document data as JSON to the SSR server and we
  91         # should get HTML text (encoded as plain text) in the body
  92         # of the response
  93         response = requests.post(
  94             url,
  95             headers={"Content-Type": "application/json"},
  96             data=json.dumps(data).encode("utf8"),
  97             timeout=timeout,
  98         )
  99 
  100         # Even though we've got fully rendered HTML now, we still need to
  101         # send the document data along with it so that React can sync its
  102         # state on the client side with what is in the HTML. When rendering
  103         # a document page, the data includes long strings of HTML that
  104         # we can get away without duplicating. So as an optimization when
  105         # component_name is "document", we're going to make a copy of the
  106         # data (because the original belongs to our caller) and delete those
  107         # strings from the copy.
  108         #
  109         # WARNING: This optimization can save 20kb in data transfer
  110         # for typical pages, but it requires us to be very careful on
  111         # the frontend. If any components render conditionally based on
  112         # the state of bodyHTML, tocHTML or quickLinkHTML, then they will
  113         # render differently on the client than during SSR, and the hydrate
  114         # will not just work cleanly, and those components will re-render
  115         # with empty strings. This has already caused Bug 1558308, and
  116         # I've commented it out because the benefit in file size doesn't
  117         # seem worth the risk of client-side bugs.
  118         #
  119         # As an alternative, it ought to be possible to extract the HTML
  120         # strings from the SSR'ed document and rebuild the document object
  121         # on the client right before we call hydrate(). So if you uncomment
  122         # the lines below, you should also edit kuma/javascript/src/index.jsx
  123         # to extract the HTML from the document as well.
  124         #
  125         # if component_name == 'document':
  126         #     data = data.copy()
  127         #     data['documentData'] = data['documentData'].copy()
  128         #     data['documentData'].update(bodyHTML='',
  129         #                                 tocHTML='',
  130         #                                 quickLinksHTML='')
  131         response.raise_for_status()
  132         result = response.json()
  133         return _render(component_name, result["html"], result["script"])
  134 
  135     except requests.exceptions.RequestException as exception:
  136         print(f"{exception.__class__} error contacting SSR server.")
  137         print("Falling back to client side rendering.")
  138         return client_side_render(component_name, data)
  139
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/kuma/wiki/templatetags/ssr.py b/kuma/wiki/templatetags/ssr.py
  --- a/kuma/wiki/templatetags/ssr.py
  +++ b/kuma/wiki/templatetags/ssr.py
  @@ -41,7 +41,6 @@
           "url": url,
           "documentData": document_data,
       }
  -
       if ssr:
           return server_side_render(component_name, data)
       else:
  
verification_info: {"golden_diff": "diff --git a/kuma/wiki/templatetags/ssr.py b/kuma/wiki/templatetags/ssr.py\n--- a/kuma/wiki/templatetags/ssr.py\n+++ b/kuma/wiki/templatetags/ssr.py\n@@ -41,7 +41,6 @@\n         \"url\": url,\n         \"documentData\": document_data,\n     }\n-\n     if ssr:\n         return server_side_render(component_name, data)\n     else:\n", "issue": "\"Report a content problem\" gets wrong title\n**Summary**\r\nYou end up on https://github.com/mdn/sprints/issues/new?template=issue-template.md&projects=mdn/sprints/2&labels=user-report&title=%2Fen-US\r\n\r\nThat prefills the title only to `/en-US`.\r\n\r\n\r\n**Steps To Reproduce (STR)**\r\n\r\n1. Go to https://developer.mozilla.org/en-US/docs/Web/JavaScript\r\n2. Click \"Report a content problem\" in the \"Feedback\" menu\r\n\r\n\r\n**Actual behavior**\r\nGitHub issue form title is just `/en-US`\r\n\r\n\r\n**Expected behavior**\r\n`/en-US/docs/Web/JavaScript`\r\n\r\n\r\n**Additional context**\r\nShould it be more than just the document URI?\r\n\n", "before_files": [{"content": "import json\nimport os\nfrom functools import lru_cache\n\nimport requests\nimport requests.exceptions\nfrom django.conf import settings\nfrom django_jinja import library\n\n\n@lru_cache()\ndef get_localization_data(locale):\n    \"\"\"\n    Read the frontend string catalog for the specified locale, parse\n    it as JSON, and return the resulting dict. The returned values\n    are cached so that we don't have to read files all the time.\n    \"\"\"\n    path = os.path.join(settings.BASE_DIR, \"static\", \"jsi18n\", locale, \"react.json\")\n    with open(path, \"r\") as f:\n        return json.load(f)\n\n\n@library.global_function\ndef render_react(component_name, locale, url, document_data, ssr=True):\n    \"\"\"\n    Render a script tag to define the data and any other HTML tags needed\n    to enable the display of a React-based UI. By default, this does\n    server side rendering, falling back to client-side rendering if\n    the SSR attempt fails. Pass False as the second argument to do\n    client-side rendering unconditionally.\n\n    Note that we are not defining a generic Jinja template tag here.\n    The code in this file is specific to Kuma's React-based UI.\n    \"\"\"\n    localization_data = get_localization_data(locale)\n\n    data = {\n        \"locale\": locale,\n        \"stringCatalog\": localization_data[\"catalog\"],\n        \"pluralExpression\": localization_data[\"plural\"],\n        \"url\": url,\n        \"documentData\": document_data,\n    }\n\n    if ssr:\n        return server_side_render(component_name, data)\n    else:\n        return client_side_render(component_name, data)\n\n\ndef _render(component_name, html, script, needs_serialization=False):\n    \"\"\"A utility function used by both client side and server side rendering.\n    Returns a string that includes the specified HTML and a serialized\n    form of the state dict, in the format expected by the client-side code\n    in kuma/javascript/src/index.jsx.\n    \"\"\"\n    if needs_serialization:\n        assert isinstance(script, dict), type(script)\n        script = json.dumps(script).replace(\"</\", \"<\\\\/\")\n    else:\n        script = \"JSON.parse({})\".format(script)\n\n    return (\n        '<div id=\"react-container\" data-component-name=\"{}\">{}</div>\\n'\n        \"<script>window._react_data = {};</script>\\n\"\n    ).format(component_name, html, script)\n\n\ndef client_side_render(component_name, data):\n    \"\"\"\n    Output an empty <div> and a script with complete state so that\n    the UI can be rendered on the client-side.\n    \"\"\"\n    return _render(component_name, \"\", data, needs_serialization=True)\n\n\ndef server_side_render(component_name, data):\n    \"\"\"\n    Pre-render the React UI to HTML and output it in a <div>, and then\n    also pass the necessary serialized state in a <script> so that\n    React on the client side can sync itself with the pre-rendred HTML.\n\n    If any exceptions are thrown during the server-side rendering, we\n    fall back to client-side rendering instead.\n    \"\"\"\n    url = \"{}/{}\".format(settings.SSR_URL, component_name)\n    timeout = settings.SSR_TIMEOUT\n    # Try server side rendering\n    try:\n        # POST the document data as JSON to the SSR server and we\n        # should get HTML text (encoded as plain text) in the body\n        # of the response\n        response = requests.post(\n            url,\n            headers={\"Content-Type\": \"application/json\"},\n            data=json.dumps(data).encode(\"utf8\"),\n            timeout=timeout,\n        )\n\n        # Even though we've got fully rendered HTML now, we still need to\n        # send the document data along with it so that React can sync its\n        # state on the client side with what is in the HTML. When rendering\n        # a document page, the data includes long strings of HTML that\n        # we can get away without duplicating. So as an optimization when\n        # component_name is \"document\", we're going to make a copy of the\n        # data (because the original belongs to our caller) and delete those\n        # strings from the copy.\n        #\n        # WARNING: This optimization can save 20kb in data transfer\n        # for typical pages, but it requires us to be very careful on\n        # the frontend. If any components render conditionally based on\n        # the state of bodyHTML, tocHTML or quickLinkHTML, then they will\n        # render differently on the client than during SSR, and the hydrate\n        # will not just work cleanly, and those components will re-render\n        # with empty strings. This has already caused Bug 1558308, and\n        # I've commented it out because the benefit in file size doesn't\n        # seem worth the risk of client-side bugs.\n        #\n        # As an alternative, it ought to be possible to extract the HTML\n        # strings from the SSR'ed document and rebuild the document object\n        # on the client right before we call hydrate(). So if you uncomment\n        # the lines below, you should also edit kuma/javascript/src/index.jsx\n        # to extract the HTML from the document as well.\n        #\n        # if component_name == 'document':\n        #     data = data.copy()\n        #     data['documentData'] = data['documentData'].copy()\n        #     data['documentData'].update(bodyHTML='',\n        #                                 tocHTML='',\n        #                                 quickLinksHTML='')\n        response.raise_for_status()\n        result = response.json()\n        return _render(component_name, result[\"html\"], result[\"script\"])\n\n    except requests.exceptions.RequestException as exception:\n        print(f\"{exception.__class__} error contacting SSR server.\")\n        print(\"Falling back to client side rendering.\")\n        return client_side_render(component_name, data)\n", "path": "kuma/wiki/templatetags/ssr.py"}], "after_files": [{"content": "import json\nimport os\nfrom functools import lru_cache\n\nimport requests\nimport requests.exceptions\nfrom django.conf import settings\nfrom django_jinja import library\n\n\n@lru_cache()\ndef get_localization_data(locale):\n    \"\"\"\n    Read the frontend string catalog for the specified locale, parse\n    it as JSON, and return the resulting dict. The returned values\n    are cached so that we don't have to read files all the time.\n    \"\"\"\n    path = os.path.join(settings.BASE_DIR, \"static\", \"jsi18n\", locale, \"react.json\")\n    with open(path, \"r\") as f:\n        return json.load(f)\n\n\n@library.global_function\ndef render_react(component_name, locale, url, document_data, ssr=True):\n    \"\"\"\n    Render a script tag to define the data and any other HTML tags needed\n    to enable the display of a React-based UI. By default, this does\n    server side rendering, falling back to client-side rendering if\n    the SSR attempt fails. Pass False as the second argument to do\n    client-side rendering unconditionally.\n\n    Note that we are not defining a generic Jinja template tag here.\n    The code in this file is specific to Kuma's React-based UI.\n    \"\"\"\n    localization_data = get_localization_data(locale)\n\n    data = {\n        \"locale\": locale,\n        \"stringCatalog\": localization_data[\"catalog\"],\n        \"pluralExpression\": localization_data[\"plural\"],\n        \"url\": url,\n        \"documentData\": document_data,\n    }\n    if ssr:\n        return server_side_render(component_name, data)\n    else:\n        return client_side_render(component_name, data)\n\n\ndef _render(component_name, html, script, needs_serialization=False):\n    \"\"\"A utility function used by both client side and server side rendering.\n    Returns a string that includes the specified HTML and a serialized\n    form of the state dict, in the format expected by the client-side code\n    in kuma/javascript/src/index.jsx.\n    \"\"\"\n    if needs_serialization:\n        assert isinstance(script, dict), type(script)\n        script = json.dumps(script).replace(\"</\", \"<\\\\/\")\n    else:\n        script = \"JSON.parse({})\".format(script)\n\n    return (\n        '<div id=\"react-container\" data-component-name=\"{}\">{}</div>\\n'\n        \"<script>window._react_data = {};</script>\\n\"\n    ).format(component_name, html, script)\n\n\ndef client_side_render(component_name, data):\n    \"\"\"\n    Output an empty <div> and a script with complete state so that\n    the UI can be rendered on the client-side.\n    \"\"\"\n    return _render(component_name, \"\", data, needs_serialization=True)\n\n\ndef server_side_render(component_name, data):\n    \"\"\"\n    Pre-render the React UI to HTML and output it in a <div>, and then\n    also pass the necessary serialized state in a <script> so that\n    React on the client side can sync itself with the pre-rendred HTML.\n\n    If any exceptions are thrown during the server-side rendering, we\n    fall back to client-side rendering instead.\n    \"\"\"\n    url = \"{}/{}\".format(settings.SSR_URL, component_name)\n    timeout = settings.SSR_TIMEOUT\n    # Try server side rendering\n    try:\n        # POST the document data as JSON to the SSR server and we\n        # should get HTML text (encoded as plain text) in the body\n        # of the response\n        response = requests.post(\n            url,\n            headers={\"Content-Type\": \"application/json\"},\n            data=json.dumps(data).encode(\"utf8\"),\n            timeout=timeout,\n        )\n\n        # Even though we've got fully rendered HTML now, we still need to\n        # send the document data along with it so that React can sync its\n        # state on the client side with what is in the HTML. When rendering\n        # a document page, the data includes long strings of HTML that\n        # we can get away without duplicating. So as an optimization when\n        # component_name is \"document\", we're going to make a copy of the\n        # data (because the original belongs to our caller) and delete those\n        # strings from the copy.\n        #\n        # WARNING: This optimization can save 20kb in data transfer\n        # for typical pages, but it requires us to be very careful on\n        # the frontend. If any components render conditionally based on\n        # the state of bodyHTML, tocHTML or quickLinkHTML, then they will\n        # render differently on the client than during SSR, and the hydrate\n        # will not just work cleanly, and those components will re-render\n        # with empty strings. This has already caused Bug 1558308, and\n        # I've commented it out because the benefit in file size doesn't\n        # seem worth the risk of client-side bugs.\n        #\n        # As an alternative, it ought to be possible to extract the HTML\n        # strings from the SSR'ed document and rebuild the document object\n        # on the client right before we call hydrate(). So if you uncomment\n        # the lines below, you should also edit kuma/javascript/src/index.jsx\n        # to extract the HTML from the document as well.\n        #\n        # if component_name == 'document':\n        #     data = data.copy()\n        #     data['documentData'] = data['documentData'].copy()\n        #     data['documentData'].update(bodyHTML='',\n        #                                 tocHTML='',\n        #                                 quickLinksHTML='')\n        response.raise_for_status()\n        result = response.json()\n        return _render(component_name, result[\"html\"], result[\"script\"])\n\n    except requests.exceptions.RequestException as exception:\n        print(f\"{exception.__class__} error contacting SSR server.\")\n        print(\"Falling back to client side rendering.\")\n        return client_side_render(component_name, data)\n", "path": "kuma/wiki/templatetags/ssr.py"}]}