Commit f79a55bf authored by Austin Tankiang's avatar Austin Tankiang Committed by Commit Bot

Fix paths returned from searchFilesByHashes

The old logic for constructing these paths were taken from the legacy
drive client code, and returned completely wrong paths for DriveFS. It
turns out this doesn't matter because nothing uses these paths. In any
case, change it to return relative drive paths for now.

Bug: 1003238
Change-Id: I6ff75ca18c80acc7af976dc97801f7ac66bf70e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808981
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698407}
parent de899b52
...@@ -1119,7 +1119,7 @@ FileManagerPrivateSearchFilesByHashesFunction::Run() { ...@@ -1119,7 +1119,7 @@ FileManagerPrivateSearchFilesByHashesFunction::Run() {
this, hashes, this, hashes,
integration_service->GetMountPointPath().Append( integration_service->GetMountPointPath().Append(
drive::util::kDriveMyDriveRootDirName), drive::util::kDriveMyDriveRootDirName),
drive::util::GetDriveMountPointPath(chrome_details_.GetProfile())), base::FilePath("/").Append(drive::util::kDriveMyDriveRootDirName)),
base::BindOnce( base::BindOnce(
&FileManagerPrivateSearchFilesByHashesFunction::OnSearchByAttribute, &FileManagerPrivateSearchFilesByHashesFunction::OnSearchByAttribute,
this, hashes)); this, hashes));
...@@ -1184,10 +1184,7 @@ void FileManagerPrivateSearchFilesByHashesFunction::OnSearchByHashes( ...@@ -1184,10 +1184,7 @@ void FileManagerPrivateSearchFilesByHashesFunction::OnSearchByHashes(
DCHECK(result->HasKey(hashAndPath.hash)); DCHECK(result->HasKey(hashAndPath.hash));
base::ListValue* list; base::ListValue* list;
result->GetListWithoutPathExpansion(hashAndPath.hash, &list); result->GetListWithoutPathExpansion(hashAndPath.hash, &list);
list->AppendString( list->AppendString(hashAndPath.path.value());
file_manager::util::ConvertDrivePathToFileSystemUrl(
chrome_details_.GetProfile(), hashAndPath.path, extension_id())
.spec());
} }
Respond(OneArgument(std::move(result))); Respond(OneArgument(std::move(result)));
} }
......
...@@ -766,9 +766,10 @@ callback SearchDriveMetadataCallback = ...@@ -766,9 +766,10 @@ callback SearchDriveMetadataCallback =
callback SearchFilesCallback = void([instanceOf=Entry] object[] entries); callback SearchFilesCallback = void([instanceOf=Entry] object[] entries);
// |urls| The map of hash and array of FileEntry's URL. The array can be empty // |paths| A map of hash to array of drive paths. The array can be empty
// if the corresponding file is not found. // if the corresponding file is not found. However, the array will only
callback SearchFilesByHashesCallback = void(object urls); // contain at most one path per hash.
callback SearchFilesByHashesCallback = void(object paths);
callback ZipSelectionCallback = void(optional boolean success); callback ZipSelectionCallback = void(optional boolean success);
...@@ -1061,7 +1062,6 @@ interface Functions { ...@@ -1061,7 +1062,6 @@ interface Functions {
SearchDriveMetadataCallback callback); SearchDriveMetadataCallback callback);
// Search files in the volume having |volumeId| by using |hashList|. // Search files in the volume having |volumeId| by using |hashList|.
// sub-directories) the given |targetDirectoryUrl|.
static void searchFilesByHashes(DOMString volumeId, static void searchFilesByHashes(DOMString volumeId,
DOMString[] hashList, DOMString[] hashList,
SearchFilesByHashesCallback callback); SearchFilesByHashesCallback callback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment