From: Piotr Kosko/Native/Web API (PLT) /SRPOL/Professional/삼성전자 Date: Mon, 8 Apr 2019 08:18:05 +0000 (+0200) Subject: [Filesystem] listFiles method of File ignores files without access X-Git-Tag: submit/tizen/20190415.072715~2^2^2^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b1db67d895aecb2dcee0bda287e5c012b3345bfd;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Filesystem] listFiles method of File ignores files without access [Bug] Files with invalid SMACK labels (not allowed to be accessed by app) caused exception about missing member ("location is required argument"). Fix ignores the files that cannot be accessed. [Verification] Manually checked with Chrome console and trying to list files with invalid SMACK label. Files are being ignored. 100% passrate for filesystem module. Change-Id: I48ed83ebbba5d0c6cfa0e597f083a7a1abce17fa --- diff --git a/src/filesystem/filesystem_instance.cc b/src/filesystem/filesystem_instance.cc index fbd555fd..6c2367fd 100644 --- a/src/filesystem/filesystem_instance.cc +++ b/src/filesystem/filesystem_instance.cc @@ -657,7 +657,13 @@ void FilesystemInstance::ReadDir(const picojson::value& args, picojson::object& obj["callbackId"] = picojson::value(callback_id); for (auto path : paths) { FilesystemStat stat = FilesystemStat::getStat(path); - statPaths.push_back(stat.toJSON()); + + if (FilesystemError::None == stat.error) { + statPaths.push_back(stat.toJSON()); + } else { + LoggerW("File stat for path: %s failed with error: %d. Ignoring this entry.", path.c_str(), + static_cast::type>(stat.error)); + } } ReportSuccess(result, obj); Instance::PostMessage(this, response.serialize().c_str());