versity/versitygw

posix: directory object get returns internal server error

Closed this issue · 1 comments

Describe the bug
A GET on a directory type object returns internal server error

To Reproduce
client:

% aws s3api put-object --bucket test --key top/test.dir/                                     
{
    "ETag": "d41d8cd98f00b204e9800998ecf8427e"
}

% aws s3 cp s3://test/top/test.dir/ test.file  
download failed: s3://test/top/test.dir/ to ./test.file An error occurred (InternalError) when calling the GetObject operation (reached max retries: 2): We encountered an internal error, please try again.

server:

16:40:34 | 200 |     215.917µs |       127.0.0.1 | PUT     | /test/top/test.dir/  
16:40:54 | 200 |         137µs |       127.0.0.1 | HEAD    | /test/top/test.dir/  
2023/10/06 16:40:54 Internal Error, copy data: read test/top/test.dir: is a directory
16:40:54 | 500 |     173.584µs |       127.0.0.1 | GET     | /test/top/test.dir/  
2023/10/06 16:40:55 Internal Error, copy data: read test/top/test.dir: is a directory
16:40:55 | 500 |     425.625µs |       127.0.0.1 | GET     | /test/top/test.dir/  
2023/10/06 16:40:56 Internal Error, copy data: read test/top/test.dir: is a directory
16:40:56 | 500 |     510.416µs |       127.0.0.1 | GET     | /test/top/test.dir/  

Expected behavior
For posix, I think we should always return a 0 length object. There is another PR outstanding to not allow content length >0 for PUT of directory object.

fixed in #277