Commit ed7527de authored by Joe Hoyle's avatar Joe Hoyle
Browse files

Handle weird edge case with is_dir() on a partial path containing file extensions

parent bdb705e2
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -369,6 +369,18 @@ class StreamWrapper
				return $this->formatUrlStat(self::$client->headObject($parts)->toArray());
			} catch (NoSuchKeyException $e) {
				// Maybe this isn't an actual key, but a prefix. Do a prefix listing of objects to determine.

				/**
				 * Modification by Joe Hoyle
				 * 
				 * If there is an extension, we don't need to check if it's a dir. There is an issue with checking
				 * if it's a dir, as s3 doesn't have true directories. See https://forums.aws.amazon.com/thread.jspa?threadID=142985
				 * for a more in-depth example.
				 */
				if ( $extension ) {
					return $this->triggerError("File or directory not found: {$path}", $flags);
				}

				$result = self::$client->listObjects(array(
					'Bucket'  => $parts['Bucket'],
					'Prefix'  => $parts['Key'],