Index: chrome/browser/resources/file_manager/js/file_copy_manager.js |
diff --git a/chrome/browser/resources/file_manager/js/file_copy_manager.js b/chrome/browser/resources/file_manager/js/file_copy_manager.js |
index 47db7dca05913f7080a0bfc3a7890bea720841e3..41af9268ca660a06dbd0a92c106dd54203635676 100644 |
--- a/chrome/browser/resources/file_manager/js/file_copy_manager.js |
+++ b/chrome/browser/resources/file_manager/js/file_copy_manager.js |
@@ -491,6 +491,29 @@ FileCopyManager.prototype.serviceNextTaskEntry_ = function( |
var targetDirEntry = task.targetDirEntry; |
var originalPath = sourceEntry.fullPath.substr(sourcePath.length + 1); |
+ |
+ // If the source entry is GData search result, we should not use the file name |
+ // we get from file entry (this will be in format |
+ // resource_id.original_file_name). Instead, we should use original_file_name. |
+ // Note that if the entry is GData search result, it can only be immediate |
+ // child of |task.sourceDirEntry|, so originalPath should be equal to |
+ // gdataSearchResult.fileName. |
+ var gdataSearchResult = |
+ util.getFileAndDisplayNameForGDataSearchResult(sourceEntry.fullPath); |
+ if (gdataSearchResult && originalPath != gdataSearchResult.displayName) { |
+ if (sourceEntry.isDirectory) { |
+ // We usually register paths relative to sourceDirEntry, but since the |
+ // entries for which we have to do this can only be immediate children of |
+ // the source dir, registering names should be fine. |
+ task.registerRename(gdataSearchResult.fileName, |
+ gdataSearchResult.displayName); |
+ } |
+ // Registered rename paths are appended '/', so we have to change |
+ // |originalPath| for directory entries too. |originalPath| won't be changed |
+ // during applyRenames (at least not by applying just registered rename). |
+ originalPath = gdataSearchResult.displayName; |
+ } |
+ |
originalPath = task.applyRenames(originalPath); |
var targetRelativePrefix = originalPath; |