mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-17 17:55:12 +00:00
Set directory MIME type to application/x-directory
Previously s3fs auto-detected the MIME type of directories like "TOYOTA TRUCK 8.2.2" as application/x-troff-man. This caused get_mode to not set S_IFDIR which failed directory creation. Instead force all object names ending in / to application/x-directory. Fixes #1183.
This commit is contained in:
parent
4df50e7f85
commit
bc9126d774
@ -671,6 +671,10 @@ void S3fsCurl::InitUserAgent()
|
|||||||
//
|
//
|
||||||
string S3fsCurl::LookupMimeType(const string& name)
|
string S3fsCurl::LookupMimeType(const string& name)
|
||||||
{
|
{
|
||||||
|
if(!name.empty() && name[name.size() - 1] == '/'){
|
||||||
|
return "application/x-directory";
|
||||||
|
}
|
||||||
|
|
||||||
string result("application/octet-stream");
|
string result("application/octet-stream");
|
||||||
string::size_type last_pos = name.find_last_of('.');
|
string::size_type last_pos = name.find_last_of('.');
|
||||||
string::size_type first_pos = name.find_first_of('.');
|
string::size_type first_pos = name.find_first_of('.');
|
||||||
|
@ -1109,7 +1109,6 @@ static int create_directory_object(const char* path, mode_t mode, time_t time, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
headers_t meta;
|
headers_t meta;
|
||||||
meta["Content-Type"] = string("application/x-directory");
|
|
||||||
meta["x-amz-meta-uid"] = str(uid);
|
meta["x-amz-meta-uid"] = str(uid);
|
||||||
meta["x-amz-meta-gid"] = str(gid);
|
meta["x-amz-meta-gid"] = str(gid);
|
||||||
meta["x-amz-meta-mode"] = str(mode);
|
meta["x-amz-meta-mode"] = str(mode);
|
||||||
|
@ -457,6 +457,8 @@ function test_special_characters {
|
|||||||
ls 'special~' 2>&1 | grep -q 'No such file or directory'
|
ls 'special~' 2>&1 | grep -q 'No such file or directory'
|
||||||
ls 'specialµ' 2>&1 | grep -q 'No such file or directory'
|
ls 'specialµ' 2>&1 | grep -q 'No such file or directory'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
mkdir "TOYOTA TRUCK 8.2.2"
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_symlink {
|
function test_symlink {
|
||||||
@ -723,6 +725,13 @@ function test_content_type() {
|
|||||||
echo "Unexpected Content-Type: $CONTENT_TYPE"
|
echo "Unexpected Content-Type: $CONTENT_TYPE"
|
||||||
return 1;
|
return 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir "test.dir"
|
||||||
|
CONTENT_TYPE=$(aws_cli s3api head-object --bucket "${TEST_BUCKET_1}" --key "${DIR_NAME}/test.dir/" | grep "ContentType")
|
||||||
|
if ! echo $CONTENT_TYPE | grep -q "application/x-directory"; then
|
||||||
|
echo "Unexpected Content-Type: $CONTENT_TYPE"
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_all_tests {
|
function add_all_tests {
|
||||||
|
Loading…
Reference in New Issue
Block a user