mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-24 14:28:24 +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;
|
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
|
// Class S3ObjList
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -722,13 +736,13 @@ mode_t get_mode(headers_t& meta, const char* path, bool checkdir, bool forcedir)
|
|||||||
if(forcedir){
|
if(forcedir){
|
||||||
mode |= S_IFDIR;
|
mode |= S_IFDIR;
|
||||||
}else{
|
}else{
|
||||||
if(meta.end() != (iter = meta.find("Content-Type"))){
|
if(meta.end() != (iter = find_content_type(meta))){
|
||||||
string strConType = (*iter).second;
|
string strConType = (*iter).second;
|
||||||
// Leave just the mime type, remove any optional parameters (eg charset)
|
// Leave just the mime type, remove any optional parameters (eg charset)
|
||||||
string::size_type pos = strConType.find(";");
|
string::size_type pos = strConType.find(";");
|
||||||
if(string::npos != pos){
|
if(string::npos != pos){
|
||||||
strConType = strConType.substr(0, pos);
|
strConType = strConType.substr(0, pos);
|
||||||
}
|
}
|
||||||
if(strConType == "application/x-directory"){
|
if(strConType == "application/x-directory"){
|
||||||
mode |= S_IFDIR;
|
mode |= S_IFDIR;
|
||||||
}else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){
|
}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",
|
// if there is not Content-Type, or Content-Type is "x-directory",
|
||||||
// checking is no more.
|
// checking is no more.
|
||||||
if(meta.end() == (iter = meta.find("Content-Type"))){
|
if(meta.end() == (iter = find_content_type(meta))){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if("application/x-directory" == (*iter).second){
|
if("application/x-directory" == (*iter).second){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user