prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
   Admin UI: Fix media browser file upload
  An exception is raised when you manually select the file while uploading it. To reproduce:
  - Go to Products
  - Select/Create a product
  - Go to Files section
  - Click over the dropzone area
  - In the media browser window, click Upload
  - Select a file and check the console (error)
  
  ![image](https://user-images.githubusercontent.com/8770370/51994097-3b982880-2497-11e9-972e-9c890268ea5b.png)
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `shuup/admin/browser_config.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 # This file is part of Shuup.
  3 #
  4 # Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved.
  5 #
  6 # This source code is licensed under the OSL-3.0 license found in the
  7 # LICENSE file in the root directory of this source tree.
  8 from django.conf import settings
  9 
  10 from shuup.utils.i18n import get_current_babel_locale
  11 
  12 
  13 class BaseBrowserConfigProvider(object):
  14     @classmethod
  15     def get_browser_urls(cls, request, **kwargs):
  16         return {}
  17 
  18     @classmethod
  19     def get_gettings(cls, request, **kwargs):
  20         return {}
  21 
  22 
  23 class DefaultBrowserConfigProvider(BaseBrowserConfigProvider):
  24     @classmethod
  25     def get_browser_urls(cls, request, **kwargs):
  26         return {
  27             "edit": "shuup_admin:edit",
  28             "select": "shuup_admin:select",
  29             "media": "shuup_admin:media.browse",
  30             "product": "shuup_admin:shop_product.list",
  31             "contact": "shuup_admin:contact.list",
  32             "setLanguage": "shuup_admin:set-language",
  33             "tour": "shuup_admin:tour",
  34             "menu_toggle": "shuup_admin:menu_toggle"
  35         }
  36 
  37     @classmethod
  38     def get_gettings(cls, request, **kwargs):
  39         return {
  40             "minSearchInputLength": settings.SHUUP_ADMIN_MINIMUM_INPUT_LENGTH_SEARCH or 1,
  41             "dateInputFormat": settings.SHUUP_ADMIN_DATE_INPUT_FORMAT,
  42             "datetimeInputFormat": settings.SHUUP_ADMIN_DATETIME_INPUT_FORMAT,
  43             "timeInputFormat": settings.SHUUP_ADMIN_TIME_INPUT_FORMAT,
  44             "datetimeInputStep": settings.SHUUP_ADMIN_DATETIME_INPUT_STEP,
  45             "dateInputLocale": get_current_babel_locale().language
  46         }
  47
  ```
  --- 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/shuup/admin/browser_config.py b/shuup/admin/browser_config.py
  --- a/shuup/admin/browser_config.py
  +++ b/shuup/admin/browser_config.py
  @@ -7,6 +7,7 @@
   # LICENSE file in the root directory of this source tree.
   from django.conf import settings
   
  +from shuup.admin.utils.permissions import has_permission
   from shuup.utils.i18n import get_current_babel_locale
   
   
  @@ -26,7 +27,7 @@
           return {
               "edit": "shuup_admin:edit",
               "select": "shuup_admin:select",
  -            "media": "shuup_admin:media.browse",
  +            "media": ("shuup_admin:media.browse" if has_permission(request.user, "shuup_admin:media.browse") else None),
               "product": "shuup_admin:shop_product.list",
               "contact": "shuup_admin:contact.list",
               "setLanguage": "shuup_admin:set-language",
  @@ -42,5 +43,6 @@
               "datetimeInputFormat": settings.SHUUP_ADMIN_DATETIME_INPUT_FORMAT,
               "timeInputFormat": settings.SHUUP_ADMIN_TIME_INPUT_FORMAT,
               "datetimeInputStep": settings.SHUUP_ADMIN_DATETIME_INPUT_STEP,
  -            "dateInputLocale": get_current_babel_locale().language
  +            "dateInputLocale": get_current_babel_locale().language,
  +            "staticPrefix": settings.STATIC_URL,
           }
  
verification_info: {"golden_diff": "diff --git a/shuup/admin/browser_config.py b/shuup/admin/browser_config.py\n--- a/shuup/admin/browser_config.py\n+++ b/shuup/admin/browser_config.py\n@@ -7,6 +7,7 @@\n # LICENSE file in the root directory of this source tree.\n from django.conf import settings\n \n+from shuup.admin.utils.permissions import has_permission\n from shuup.utils.i18n import get_current_babel_locale\n \n \n@@ -26,7 +27,7 @@\n         return {\n             \"edit\": \"shuup_admin:edit\",\n             \"select\": \"shuup_admin:select\",\n-            \"media\": \"shuup_admin:media.browse\",\n+            \"media\": (\"shuup_admin:media.browse\" if has_permission(request.user, \"shuup_admin:media.browse\") else None),\n             \"product\": \"shuup_admin:shop_product.list\",\n             \"contact\": \"shuup_admin:contact.list\",\n             \"setLanguage\": \"shuup_admin:set-language\",\n@@ -42,5 +43,6 @@\n             \"datetimeInputFormat\": settings.SHUUP_ADMIN_DATETIME_INPUT_FORMAT,\n             \"timeInputFormat\": settings.SHUUP_ADMIN_TIME_INPUT_FORMAT,\n             \"datetimeInputStep\": settings.SHUUP_ADMIN_DATETIME_INPUT_STEP,\n-            \"dateInputLocale\": get_current_babel_locale().language\n+            \"dateInputLocale\": get_current_babel_locale().language,\n+            \"staticPrefix\": settings.STATIC_URL,\n         }\n", "issue": " Admin UI: Fix media browser file upload\nAn exception is raised when you manually select the file while uploading it. To reproduce:\r\n- Go to Products\r\n- Select/Create a product\r\n- Go to Files section\r\n- Click over the dropzone area\r\n- In the media browser window, click Upload\r\n- Select a file and check the console (error)\r\n\r\n![image](https://user-images.githubusercontent.com/8770370/51994097-3b982880-2497-11e9-972e-9c890268ea5b.png)\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# This file is part of Shuup.\n#\n# Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved.\n#\n# This source code is licensed under the OSL-3.0 license found in the\n# LICENSE file in the root directory of this source tree.\nfrom django.conf import settings\n\nfrom shuup.utils.i18n import get_current_babel_locale\n\n\nclass BaseBrowserConfigProvider(object):\n    @classmethod\n    def get_browser_urls(cls, request, **kwargs):\n        return {}\n\n    @classmethod\n    def get_gettings(cls, request, **kwargs):\n        return {}\n\n\nclass DefaultBrowserConfigProvider(BaseBrowserConfigProvider):\n    @classmethod\n    def get_browser_urls(cls, request, **kwargs):\n        return {\n            \"edit\": \"shuup_admin:edit\",\n            \"select\": \"shuup_admin:select\",\n            \"media\": \"shuup_admin:media.browse\",\n            \"product\": \"shuup_admin:shop_product.list\",\n            \"contact\": \"shuup_admin:contact.list\",\n            \"setLanguage\": \"shuup_admin:set-language\",\n            \"tour\": \"shuup_admin:tour\",\n            \"menu_toggle\": \"shuup_admin:menu_toggle\"\n        }\n\n    @classmethod\n    def get_gettings(cls, request, **kwargs):\n        return {\n            \"minSearchInputLength\": settings.SHUUP_ADMIN_MINIMUM_INPUT_LENGTH_SEARCH or 1,\n            \"dateInputFormat\": settings.SHUUP_ADMIN_DATE_INPUT_FORMAT,\n            \"datetimeInputFormat\": settings.SHUUP_ADMIN_DATETIME_INPUT_FORMAT,\n            \"timeInputFormat\": settings.SHUUP_ADMIN_TIME_INPUT_FORMAT,\n            \"datetimeInputStep\": settings.SHUUP_ADMIN_DATETIME_INPUT_STEP,\n            \"dateInputLocale\": get_current_babel_locale().language\n        }\n", "path": "shuup/admin/browser_config.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n# This file is part of Shuup.\n#\n# Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved.\n#\n# This source code is licensed under the OSL-3.0 license found in the\n# LICENSE file in the root directory of this source tree.\nfrom django.conf import settings\n\nfrom shuup.admin.utils.permissions import has_permission\nfrom shuup.utils.i18n import get_current_babel_locale\n\n\nclass BaseBrowserConfigProvider(object):\n    @classmethod\n    def get_browser_urls(cls, request, **kwargs):\n        return {}\n\n    @classmethod\n    def get_gettings(cls, request, **kwargs):\n        return {}\n\n\nclass DefaultBrowserConfigProvider(BaseBrowserConfigProvider):\n    @classmethod\n    def get_browser_urls(cls, request, **kwargs):\n        return {\n            \"edit\": \"shuup_admin:edit\",\n            \"select\": \"shuup_admin:select\",\n            \"media\": (\"shuup_admin:media.browse\" if has_permission(request.user, \"shuup_admin:media.browse\") else None),\n            \"product\": \"shuup_admin:shop_product.list\",\n            \"contact\": \"shuup_admin:contact.list\",\n            \"setLanguage\": \"shuup_admin:set-language\",\n            \"tour\": \"shuup_admin:tour\",\n            \"menu_toggle\": \"shuup_admin:menu_toggle\"\n        }\n\n    @classmethod\n    def get_gettings(cls, request, **kwargs):\n        return {\n            \"minSearchInputLength\": settings.SHUUP_ADMIN_MINIMUM_INPUT_LENGTH_SEARCH or 1,\n            \"dateInputFormat\": settings.SHUUP_ADMIN_DATE_INPUT_FORMAT,\n            \"datetimeInputFormat\": settings.SHUUP_ADMIN_DATETIME_INPUT_FORMAT,\n            \"timeInputFormat\": settings.SHUUP_ADMIN_TIME_INPUT_FORMAT,\n            \"datetimeInputStep\": settings.SHUUP_ADMIN_DATETIME_INPUT_STEP,\n            \"dateInputLocale\": get_current_babel_locale().language,\n            \"staticPrefix\": settings.STATIC_URL,\n        }\n", "path": "shuup/admin/browser_config.py"}]}