moto 4.2.3.dev16__py2.py3-none-any.whl → 4.2.3.dev17__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
moto/__init__.py CHANGED
@@ -211,7 +211,7 @@ mock_all = MockAll
211
211
  # logging.getLogger('boto').setLevel(logging.CRITICAL)
212
212
 
213
213
  __title__ = "moto"
214
- __version__ = "4.2.3.dev16"
214
+ __version__ = "4.2.3.dev17"
215
215
 
216
216
 
217
217
  try:
moto/s3/responses.py CHANGED
@@ -1169,25 +1169,35 @@ class S3Response(BaseResponse):
1169
1169
  ) -> TYPE_RESPONSE:
1170
1170
  length = len(response_content)
1171
1171
  last = length - 1
1172
+
1172
1173
  _, rspec = request.headers.get("range").split("=")
1173
1174
  if "," in rspec:
1174
- raise NotImplementedError("Multiple range specifiers not supported")
1175
+ return 200, response_headers, response_content
1176
+
1177
+ try:
1178
+ begin, end = [int(i) if i else None for i in rspec.split("-")]
1179
+ except ValueError:
1180
+ # if we can't parse the Range header, S3 just treat the request as a non-range request
1181
+ return 200, response_headers, response_content
1175
1182
 
1176
- def toint(i: Any) -> Optional[int]:
1177
- return int(i) if i else None
1183
+ if (begin is None and end == 0) or (begin is not None and begin > last):
1184
+ raise InvalidRange(
1185
+ actual_size=str(length), range_requested=request.headers.get("range")
1186
+ )
1178
1187
 
1179
- begin, end = map(toint, rspec.split("-"))
1180
1188
  if begin is not None: # byte range
1181
1189
  end = last if end is None else min(end, last)
1182
1190
  elif end is not None: # suffix byte range
1183
1191
  begin = length - min(end, length)
1184
1192
  end = last
1185
1193
  else:
1186
- return 400, response_headers, ""
1187
- if begin < 0 or end > last or begin > min(end, last):
1188
- raise InvalidRange(
1189
- actual_size=str(length), range_requested=request.headers.get("range")
1190
- )
1194
+ # Treat as non-range request
1195
+ return 200, response_headers, response_content
1196
+
1197
+ if begin > min(end, last):
1198
+ # Treat as non-range request if after the logic is applied, the start of the range is greater than the end
1199
+ return 200, response_headers, response_content
1200
+
1191
1201
  response_headers["content-range"] = f"bytes {begin}-{end}/{length}"
1192
1202
  content = response_content[begin : end + 1]
1193
1203
  response_headers["content-length"] = len(content)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moto
3
- Version: 4.2.3.dev16
3
+ Version: 4.2.3.dev17
4
4
  Home-page: https://github.com/getmoto/moto
5
5
  Author: Steve Pulec
6
6
  Author-email: "spulec@gmail.com"
@@ -1,4 +1,4 @@
1
- moto/__init__.py,sha256=kCcZiaceHIsAsT9Wln067PpnaHjzIsCIJTA0dMBej7Y,9630
1
+ moto/__init__.py,sha256=WsqX_B-R7otRD54x6Vob_NTV2IiwJEGdqe7Nqv_-7N0,9630
2
2
  moto/backend_index.py,sha256=CXt1WInpx_9a2USMqIkiEoWFqRdsASOuE7AzbVp5a6A,10629
3
3
  moto/backends.py,sha256=rC9WUMUUWmVmX7ZEfXpVKAQAw6oI8qYobCEPxP2Zv9U,1805
4
4
  moto/server.py,sha256=cp8kIe5jVOm7Z2BlNN2AMbTfrRvLBEKSb4mt7O8nu34,2858
@@ -807,7 +807,7 @@ moto/s3/config.py,sha256=xrV-Uj3BMBz40lbyjmktbaLg5UR7Z6Rx8W5yyw7kIUg,4810
807
807
  moto/s3/exceptions.py,sha256=iIrIq5QfR5LVFIyCULhZfJuOx0jyXdgAyBmXw_CRFgM,15785
808
808
  moto/s3/models.py,sha256=koKn0vyVyNbYcv6SDEhggrt5RSDVqs1f0XHfiFhE9Zo,95206
809
809
  moto/s3/notifications.py,sha256=0C-jJXnNKApy6TX0jLL8esx7xzQ251a76fwGmdod-FA,4012
810
- moto/s3/responses.py,sha256=fP7ZVv8RShW6y3hBVfgagZlnPdF6WWr-4E_o1rEjoXk,124677
810
+ moto/s3/responses.py,sha256=gnHN9DShMfoWGTLRwplGQplfXLQRpYcJduaeZCyAsiI,125084
811
811
  moto/s3/select_object_content.py,sha256=NxQLKVML2_bqMRO4vQCMVkaKsV7XCE4kUFnMGVzi8h4,2184
812
812
  moto/s3/urls.py,sha256=XI4Z2_A7R4Z0I9o5pQ-9NNtkHvbyH0xgzJ__KbJG4hc,1005
813
813
  moto/s3/utils.py,sha256=T7eKBz3xDR20af9CxoJQHNgX3PElnHuIhxnr7Dr7neI,7137
@@ -1030,10 +1030,10 @@ moto/xray/mock_client.py,sha256=nYl8JVJbl3OY-tnUafkVOG4K4-cFm5bsft3Hxo7fKwI,3809
1030
1030
  moto/xray/models.py,sha256=0QL6nmhpVVwAiyi9aw4pBwVTRhqPW9oIy2uwPDhPKug,11179
1031
1031
  moto/xray/responses.py,sha256=p2xsg2-P9h_1DCyuBC7GenmC5L64tXAX6a-XCb2j5-o,6316
1032
1032
  moto/xray/urls.py,sha256=R6T3gMwobWipukWcC1DQ36CU1Rjt6oqBDoe-7HqaIZU,393
1033
- moto-4.2.3.dev16.dist-info/AUTHORS.md,sha256=dDUhasV8HGSkzb7zj7a0b3alnqY0P1LPOyOUNoo8Mpo,2976
1034
- moto-4.2.3.dev16.dist-info/LICENSE,sha256=8S75_TlqE-kIeGMLG0-rRxxu2ct6SM8quyUWKBYyIY4,10834
1035
- moto-4.2.3.dev16.dist-info/METADATA,sha256=p9m3u6vE3ZTIbgcg3Dwp57PSY0lgfNKTZKni-F3u7mM,12102
1036
- moto-4.2.3.dev16.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
1037
- moto-4.2.3.dev16.dist-info/entry_points.txt,sha256=aPovbZuFXCwt8_m2vcolpH4Qr3rOF3yXeRElP9Zkauo,49
1038
- moto-4.2.3.dev16.dist-info/top_level.txt,sha256=TETRKAPcAAvoZDkSkwQiZtTSr-1gzaEAXVm9FmZKj8s,5
1039
- moto-4.2.3.dev16.dist-info/RECORD,,
1033
+ moto-4.2.3.dev17.dist-info/AUTHORS.md,sha256=dDUhasV8HGSkzb7zj7a0b3alnqY0P1LPOyOUNoo8Mpo,2976
1034
+ moto-4.2.3.dev17.dist-info/LICENSE,sha256=8S75_TlqE-kIeGMLG0-rRxxu2ct6SM8quyUWKBYyIY4,10834
1035
+ moto-4.2.3.dev17.dist-info/METADATA,sha256=m1eAV_rSN_gUua1snLkMDTY2pswEyFq1k7_AAEC062g,12102
1036
+ moto-4.2.3.dev17.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
1037
+ moto-4.2.3.dev17.dist-info/entry_points.txt,sha256=aPovbZuFXCwt8_m2vcolpH4Qr3rOF3yXeRElP9Zkauo,49
1038
+ moto-4.2.3.dev17.dist-info/top_level.txt,sha256=TETRKAPcAAvoZDkSkwQiZtTSr-1gzaEAXVm9FmZKj8s,5
1039
+ moto-4.2.3.dev17.dist-info/RECORD,,