We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Return secure URLs for the fields thumbnail, detail_url and related_url.
_(Framed the verbiage of the title as a feature request)_ 🙏 

## Problem

The response for search and detail requests includes insecure URLs (`http` instead of `https`) in the fields `thumbnail`, `detail_url` and `related_url`.

![image](https://user-images.githubusercontent.com/746152/158834288-6b49c399-3b8c-48c8-8529-cdff970686a3.png)


e.g.:

**Search**

https://api.openverse.engineering/v1/images/?q=flower

**Detail:**

https://api.openverse.engineering/v1/images/6c1769b0-a3e5-4dae-8a36-8531a6e1430f/

## Description

When trying to integrate Openverse with some code on the browser I ended up having to replace the scheme part of the URL for avoiding notices like ```xxxx was loaded over HTTPS, but requested an insecure resource 'http://api.openverse.engineering/v1/images/6c1769b0-a3e5-4dae-8a36-8531a6e1430f/'. This request has been blocked; the content must be served over HTTPS.`
 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `api/catalog/api/serializers/base.py`
Content:
```
1 import re
2 
3 from django.conf import settings
4 from rest_framework import serializers
5 
6 
7 class SchemableHyperlinkedIdentityField(serializers.HyperlinkedIdentityField):
8     """
9     This field returns the link but allows the option to replace the URL scheme.
10     """
11 
12     def __init__(self, scheme=settings.API_LINK_SCHEME, *args, **kwargs):
13         super().__init__(*args, **kwargs)
14 
15         self.scheme = scheme
16 
17     def get_url(self, *args, **kwargs):
18         url = super().get_url(*args, **kwargs)
19 
20         # Only rewrite URLs if a fixed scheme is provided
21         if self.scheme is not None:
22             re.sub(r"^\w+://", f"{self.scheme}://", url, 1)
23 
24         return url
25
```
--- 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()

```

diff --git a/api/catalog/api/serializers/base.py b/api/catalog/api/serializers/base.py
--- a/api/catalog/api/serializers/base.py
+++ b/api/catalog/api/serializers/base.py
@@ -19,6 +19,6 @@
 
         # Only rewrite URLs if a fixed scheme is provided
         if self.scheme is not None:
-            re.sub(r"^\w+://", f"{self.scheme}://", url, 1)
+            url = re.sub(r"^\w+://", f"{self.scheme}://", url, 1)
 
         return url

{"golden_diff": "diff --git a/api/catalog/api/serializers/base.py b/api/catalog/api/serializers/base.py\n--- a/api/catalog/api/serializers/base.py\n+++ b/api/catalog/api/serializers/base.py\n@@ -19,6 +19,6 @@\n \n         # Only rewrite URLs if a fixed scheme is provided\n         if self.scheme is not None:\n-            re.sub(r\"^\\w+://\", f\"{self.scheme}://\", url, 1)\n+            url = re.sub(r\"^\\w+://\", f\"{self.scheme}://\", url, 1)\n \n         return url\n", "issue": "Return secure URLs for the fields thumbnail, detail_url and related_url.\n_(Framed the verbiage of the title as a feature request)_ \ud83d\ude4f \r\n\r\n## Problem\r\n\r\nThe response for search and detail requests includes insecure URLs (`http` instead of `https`) in the fields `thumbnail`, `detail_url` and `related_url`.\r\n\r\n![image](https://user-images.githubusercontent.com/746152/158834288-6b49c399-3b8c-48c8-8529-cdff970686a3.png)\r\n\r\n\r\ne.g.:\r\n\r\n**Search**\r\n\r\nhttps://api.openverse.engineering/v1/images/?q=flower\r\n\r\n**Detail:**\r\n\r\nhttps://api.openverse.engineering/v1/images/6c1769b0-a3e5-4dae-8a36-8531a6e1430f/\r\n\r\n## Description\r\n\r\nWhen trying to integrate Openverse with some code on the browser I ended up having to replace the scheme part of the URL for avoiding notices like ```xxxx was loaded over HTTPS, but requested an insecure resource 'http://api.openverse.engineering/v1/images/6c1769b0-a3e5-4dae-8a36-8531a6e1430f/'. This request has been blocked; the content must be served over HTTPS.`\r\n \r\n\n", "before_files": [{"content": "import re\n\nfrom django.conf import settings\nfrom rest_framework import serializers\n\n\nclass SchemableHyperlinkedIdentityField(serializers.HyperlinkedIdentityField):\n    \"\"\"\n    This field returns the link but allows the option to replace the URL scheme.\n    \"\"\"\n\n    def __init__(self, scheme=settings.API_LINK_SCHEME, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self.scheme = scheme\n\n    def get_url(self, *args, **kwargs):\n        url = super().get_url(*args, **kwargs)\n\n        # Only rewrite URLs if a fixed scheme is provided\n        if self.scheme is not None:\n            re.sub(r\"^\\w+://\", f\"{self.scheme}://\", url, 1)\n\n        return url\n", "path": "api/catalog/api/serializers/base.py"}], "after_files": [{"content": "import re\n\nfrom django.conf import settings\nfrom rest_framework import serializers\n\n\nclass SchemableHyperlinkedIdentityField(serializers.HyperlinkedIdentityField):\n    \"\"\"\n    This field returns the link but allows the option to replace the URL scheme.\n    \"\"\"\n\n    def __init__(self, scheme=settings.API_LINK_SCHEME, *args, **kwargs):\n        super().__init__(*args, **kwargs)\n\n        self.scheme = scheme\n\n    def get_url(self, *args, **kwargs):\n        url = super().get_url(*args, **kwargs)\n\n        # Only rewrite URLs if a fixed scheme is provided\n        if self.scheme is not None:\n            url = re.sub(r\"^\\w+://\", f\"{self.scheme}://\", url, 1)\n\n        return url\n", "path": "api/catalog/api/serializers/base.py"}]}