DEV: Limit list multipart parts to 1 (#14853)

We are only using list_multipart_parts right now in the
uploads controller for multipart uploads to check if the
upload exists; thus we don't need up to 1000 parts.

Also adding a note for future explorers that list_multipart_parts
only gets 1000 parts max, and adding params for max parts
and starting parts.
This commit is contained in:
Martin Brennan
2021-11-10 08:01:28 +10:00
committed by GitHub
parent 25ef395af8
commit 6a68bd4825
3 changed files with 29 additions and 7 deletions

View File

@@ -372,7 +372,9 @@ class UploadsController < ApplicationController
def multipart_upload_exists?(external_upload_stub)
begin
Discourse.store.list_multipart_parts(
upload_id: external_upload_stub.external_upload_identifier, key: external_upload_stub.key
upload_id: external_upload_stub.external_upload_identifier,
key: external_upload_stub.key,
max_parts: 1
)
rescue Aws::S3::Errors::NoSuchUpload => err
debug_upload_error(err, "upload.external_upload_not_found", { additional_detail: "path: #{external_upload_stub.key}" })