prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Unable to create a key with a trailing slash using OrdinaryCallingFormat
  When using OrdinaryCallingFormat, it's not possible to create a key ending with a slash (e.g. when mimicking directory creation), since this is stripped off when parsing the key name. I can't comment on S3, but this is at least different behaviour from Ceph.
  
  For example, the below fails as is, but works if the connection uses SubdomainCallingFormat instead.
  
  ```
  import boto
  import moto
  import unittest
  
  
  class TestCreatingKeyEndingWithSlash(unittest.TestCase):
  
      @moto.mock_s3
      def test_ordinary_calling_format(self):
          bucket_name = 'testbucket'
          key_name = 'key_ending_with_slash/'
  
          conn = boto.connect_s3('access_key', 'secret_key',
                                 calling_format=boto.s3.connection.OrdinaryCallingFormat())
          bucket = conn.create_bucket(bucket_name)
  
          key = boto.s3.key.Key(bucket)
          key.key = key_name
          key.set_contents_from_string('')
  
          self.assertIn(key_name, [k.name for k in bucket.get_all_keys()])
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `moto/s3bucket_path/utils.py`
  Content:
  ```
  1 from __future__ import unicode_literals
  2 from six.moves.urllib.parse import urlparse
  3 
  4 
  5 def bucket_name_from_url(url):
  6     pth = urlparse(url).path.lstrip("/")
  7 
  8     l = pth.lstrip("/").split("/")
  9     if len(l) == 0 or l[0] == "":
  10         return None
  11     return l[0]
  12 
  13 
  14 def parse_key_name(path):
  15     return "/".join(path.rstrip("/").split("/")[2:])
  16 
  17 
  18 def is_delete_keys(request, path, bucket_name):
  19     return (
  20         path == u'/' + bucket_name + u'/?delete' or
  21         path == u'/' + bucket_name + u'?delete' or
  22         (path == u'/' + bucket_name and
  23          getattr(request, "query_string", "") == "delete")
  24     )
  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()
  
  ```
  
golden_diff: diff --git a/moto/s3bucket_path/utils.py b/moto/s3bucket_path/utils.py
  --- a/moto/s3bucket_path/utils.py
  +++ b/moto/s3bucket_path/utils.py
  @@ -12,7 +12,7 @@
   
   
   def parse_key_name(path):
  -    return "/".join(path.rstrip("/").split("/")[2:])
  +    return "/".join(path.split("/")[2:])
   
   
   def is_delete_keys(request, path, bucket_name):
  
verification_info: {"golden_diff": "diff --git a/moto/s3bucket_path/utils.py b/moto/s3bucket_path/utils.py\n--- a/moto/s3bucket_path/utils.py\n+++ b/moto/s3bucket_path/utils.py\n@@ -12,7 +12,7 @@\n \n \n def parse_key_name(path):\n-    return \"/\".join(path.rstrip(\"/\").split(\"/\")[2:])\n+    return \"/\".join(path.split(\"/\")[2:])\n \n \n def is_delete_keys(request, path, bucket_name):\n", "issue": "Unable to create a key with a trailing slash using OrdinaryCallingFormat\nWhen using OrdinaryCallingFormat, it's not possible to create a key ending with a slash (e.g. when mimicking directory creation), since this is stripped off when parsing the key name. I can't comment on S3, but this is at least different behaviour from Ceph.\n\nFor example, the below fails as is, but works if the connection uses SubdomainCallingFormat instead.\n\n```\nimport boto\nimport moto\nimport unittest\n\n\nclass TestCreatingKeyEndingWithSlash(unittest.TestCase):\n\n    @moto.mock_s3\n    def test_ordinary_calling_format(self):\n        bucket_name = 'testbucket'\n        key_name = 'key_ending_with_slash/'\n\n        conn = boto.connect_s3('access_key', 'secret_key',\n                               calling_format=boto.s3.connection.OrdinaryCallingFormat())\n        bucket = conn.create_bucket(bucket_name)\n\n        key = boto.s3.key.Key(bucket)\n        key.key = key_name\n        key.set_contents_from_string('')\n\n        self.assertIn(key_name, [k.name for k in bucket.get_all_keys()])\n```\n\n", "before_files": [{"content": "from __future__ import unicode_literals\nfrom six.moves.urllib.parse import urlparse\n\n\ndef bucket_name_from_url(url):\n    pth = urlparse(url).path.lstrip(\"/\")\n\n    l = pth.lstrip(\"/\").split(\"/\")\n    if len(l) == 0 or l[0] == \"\":\n        return None\n    return l[0]\n\n\ndef parse_key_name(path):\n    return \"/\".join(path.rstrip(\"/\").split(\"/\")[2:])\n\n\ndef is_delete_keys(request, path, bucket_name):\n    return (\n        path == u'/' + bucket_name + u'/?delete' or\n        path == u'/' + bucket_name + u'?delete' or\n        (path == u'/' + bucket_name and\n         getattr(request, \"query_string\", \"\") == \"delete\")\n    )\n", "path": "moto/s3bucket_path/utils.py"}], "after_files": [{"content": "from __future__ import unicode_literals\nfrom six.moves.urllib.parse import urlparse\n\n\ndef bucket_name_from_url(url):\n    pth = urlparse(url).path.lstrip(\"/\")\n\n    l = pth.lstrip(\"/\").split(\"/\")\n    if len(l) == 0 or l[0] == \"\":\n        return None\n    return l[0]\n\n\ndef parse_key_name(path):\n    return \"/\".join(path.split(\"/\")[2:])\n\n\ndef is_delete_keys(request, path, bucket_name):\n    return (\n        path == u'/' + bucket_name + u'/?delete' or\n        path == u'/' + bucket_name + u'?delete' or\n        (path == u'/' + bucket_name and\n         getattr(request, \"query_string\", \"\") == \"delete\")\n    )\n", "path": "moto/s3bucket_path/utils.py"}]}