andersundsehr / aus_driver_amazon_s3

Provides a TYPO3 FAL driver for the Amazon Web Service S3
GNU Lesser General Public License v3.0
21 stars 40 forks source link

[BUGFIX] Respect "MaxKeys" setting when listing objects #83

Closed cweiske closed 2 years ago

cweiske commented 3 years ago

Methods prefixExists() and isFolderEmpty() both use getListObjects() with the "MaxKeys: 1" argument. If the directory contains more than one file, the API says the result is truncated (which we wanted!), which causes getListObjects() to load all objects in the folder.

This patch checks if the MaxKeys argument was provided, and prevents loading the truncated objects in that case.

On S3 this happens when using a bucket that has no special "folder objects" (which are created by aus_driver_amazon_s3).

With MinIO it always happens, because HEAD requests fail for non-empty folders, and thus listObjects is always used.