Skip to content

Commit

Permalink
Correctly handle non-ASCII paths in DiskCacheLock.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 680491370
Change-Id: Ia3454a60296fa183e59b0fde8c41da42ef75aba5
  • Loading branch information
tjgq authored and copybara-github committed Sep 30, 2024
1 parent 333b625 commit 6922734
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/remote/options",
"//src/main/java/com/google/devtools/build/lib/remote/util",
"//src/main/java/com/google/devtools/build/lib/server:idle_task",
"//src/main/java/com/google/devtools/build/lib/util:string",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//third_party:flogger",
"//third_party:guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.
package com.google.devtools.build.lib.remote.disk;

import static com.google.devtools.build.lib.util.StringUtil.reencodeInternalToExternal;

import com.google.common.annotations.VisibleForTesting;
import com.google.devtools.build.lib.vfs.Path;
import java.io.IOException;
Expand Down Expand Up @@ -56,7 +58,8 @@ private static DiskCacheLock get(Path path, boolean shared) throws IOException {
path.getParentDirectory().createDirectoryAndParents();
FileChannel channel =
FileChannel.open(
java.nio.file.Path.of(path.getPathString()),
// Correctly handle non-ASCII paths by converting from the internal string encoding.
java.nio.file.Path.of(reencodeInternalToExternal(path.getPathString())),
StandardOpenOption.READ,
StandardOpenOption.WRITE,
StandardOpenOption.CREATE);
Expand Down

0 comments on commit 6922734

Please sign in to comment.