mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-09 16:06:46 +00:00
Merge pull request #364 from ggtakec/master
Checked content-type by no case-sensitivity - #363
This commit is contained in:
commit
d6e6eebb95
@ -60,6 +60,20 @@ string get_realpath(const char *path) {
|
||||
return realpath;
|
||||
}
|
||||
|
||||
inline headers_t::const_iterator find_content_type(headers_t& meta)
|
||||
{
|
||||
headers_t::const_iterator iter;
|
||||
|
||||
if(meta.end() == (iter = meta.find("Content-Type"))){
|
||||
if(meta.end() == (iter = meta.find("Content-type"))){
|
||||
if(meta.end() == (iter = meta.find("content-type"))){
|
||||
iter = meta.find("content-Type");
|
||||
}
|
||||
}
|
||||
}
|
||||
return iter;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// Class S3ObjList
|
||||
//-------------------------------------------------------------------
|
||||
@ -722,13 +736,13 @@ mode_t get_mode(headers_t& meta, const char* path, bool checkdir, bool forcedir)
|
||||
if(forcedir){
|
||||
mode |= S_IFDIR;
|
||||
}else{
|
||||
if(meta.end() != (iter = meta.find("Content-Type"))){
|
||||
if(meta.end() != (iter = find_content_type(meta))){
|
||||
string strConType = (*iter).second;
|
||||
// Leave just the mime type, remove any optional parameters (eg charset)
|
||||
string::size_type pos = strConType.find(";");
|
||||
if(string::npos != pos){
|
||||
strConType = strConType.substr(0, pos);
|
||||
}
|
||||
if(string::npos != pos){
|
||||
strConType = strConType.substr(0, pos);
|
||||
}
|
||||
if(strConType == "application/x-directory"){
|
||||
mode |= S_IFDIR;
|
||||
}else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){
|
||||
@ -850,7 +864,7 @@ bool is_need_check_obj_detail(headers_t& meta)
|
||||
}
|
||||
// if there is not Content-Type, or Content-Type is "x-directory",
|
||||
// checking is no more.
|
||||
if(meta.end() == (iter = meta.find("Content-Type"))){
|
||||
if(meta.end() == (iter = find_content_type(meta))){
|
||||
return false;
|
||||
}
|
||||
if("application/x-directory" == (*iter).second){
|
||||
|
Loading…
Reference in New Issue
Block a user