Closed rockuw closed 8 years ago
if(strConType == "application/x-directory"){ mode |= S_IFDIR; }else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){ if(strConType == "binary/octet-stream" || strConType == "application/octet-stream"){ mode |= S_IFDIR; }else{ mode |= S_IFREG; } }else{ mode |= S_IFREG; }
判断一个object是否是目录的逻辑,要求content-type是"application/x-directory" or "binary/octet-stream" or "application/octet-stream",而不是直接根据文件后缀有没有"/"来判断。
这有点奇怪,某些工具会生成一个目录文件,但是content-type不符合要求,导致其被当成普通文件对待。
判断一个object是否是目录的逻辑,要求content-type是"application/x-directory" or "binary/octet-stream" or "application/octet-stream",而不是直接根据文件后缀有没有"/"来判断。
这有点奇怪,某些工具会生成一个目录文件,但是content-type不符合要求,导致其被当成普通文件对待。