Commit 15eebebe authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

[FS] Simplify child URL calculation in DirectoryHandleImpl.

FileSystemURL doesn't round-trip well through GURL, and it's much
simpler to generate a child URL directly from the parent FileSystemURL
anyway, so simplify NativeFileSystemDirectoryHandleImpl::GetChildURL to
skip the conversions to/from GURL.

Bug: 1093653
Change-Id: I13d515ca3e25ed7c8deca1ceb913b7dea58ed67b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2362768
Auto-Submit: Marijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800364}
parent 8451a04f
...@@ -433,16 +433,10 @@ NativeFileSystemDirectoryHandleImpl::GetChildURL( ...@@ -433,16 +433,10 @@ NativeFileSystemDirectoryHandleImpl::GetChildURL(
"Name contains invalid characters."); "Name contains invalid characters.");
} }
std::string escaped_name = const storage::FileSystemURL parent = url();
net::EscapeQueryParamValue(basename, /*use_plus=*/false); *result = file_system_context()->CreateCrackedFileSystemURL(
parent.origin(), parent.mount_type(),
GURL parent_url = url().ToGURL(); parent.virtual_path().Append(base::FilePath::FromUTF8Unsafe(basename)));
std::string path = base::StrCat({parent_url.path(), "/", escaped_name});
GURL::Replacements replacements;
replacements.SetPathStr(path);
GURL child_url = parent_url.ReplaceComponents(replacements);
*result = file_system_context()->CrackURL(child_url);
return native_file_system_error::Ok(); return native_file_system_error::Ok();
} }
......
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