Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: webkit/common/fileapi/file_system_util.cc

Issue 312283002: [fsp] Fix incorrect handling of file system URLs when containing a %. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/common/fileapi/file_system_util.h" 5 #include "webkit/common/fileapi/file_system_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 447 }
448 448
449 std::string GetIsolatedFileSystemRootURIString( 449 std::string GetIsolatedFileSystemRootURIString(
450 const GURL& origin_url, 450 const GURL& origin_url,
451 const std::string& filesystem_id, 451 const std::string& filesystem_id,
452 const std::string& optional_root_name) { 452 const std::string& optional_root_name) {
453 std::string root = GetFileSystemRootURI(origin_url, 453 std::string root = GetFileSystemRootURI(origin_url,
454 kFileSystemTypeIsolated).spec(); 454 kFileSystemTypeIsolated).spec();
455 if (base::FilePath::FromUTF8Unsafe(filesystem_id).ReferencesParent()) 455 if (base::FilePath::FromUTF8Unsafe(filesystem_id).ReferencesParent())
456 return std::string(); 456 return std::string();
457 root.append(filesystem_id); 457 root.append(net::EscapePath(filesystem_id));
kinaba 2014/06/06 05:40:11 Maybe EscapeQueryParamValue is more appropriate?
mtomasz 2014/06/06 05:45:37 Mount point names must not contain "/", per: https
kinaba 2014/06/06 06:10:47 Ah, thanks, I hope I've got your point. So, the as
mtomasz 2014/06/06 06:14:43 You're right. In mount_path_util.cc, "." need to b
458 root.append("/"); 458 root.append("/");
459 if (!optional_root_name.empty()) { 459 if (!optional_root_name.empty()) {
460 if (base::FilePath::FromUTF8Unsafe(optional_root_name).ReferencesParent()) 460 if (base::FilePath::FromUTF8Unsafe(optional_root_name).ReferencesParent())
461 return std::string(); 461 return std::string();
462 root.append(optional_root_name); 462 root.append(net::EscapePath(optional_root_name));
463 root.append("/"); 463 root.append("/");
464 } 464 }
465 return root; 465 return root;
466 } 466 }
467 467
468 std::string GetExternalFileSystemRootURIString( 468 std::string GetExternalFileSystemRootURIString(
469 const GURL& origin_url, 469 const GURL& origin_url,
470 const std::string& mount_name) { 470 const std::string& mount_name) {
471 std::string root = GetFileSystemRootURI(origin_url, 471 std::string root = GetFileSystemRootURI(origin_url,
472 kFileSystemTypeExternal).spec(); 472 kFileSystemTypeExternal).spec();
473 if (base::FilePath::FromUTF8Unsafe(mount_name).ReferencesParent()) 473 if (base::FilePath::FromUTF8Unsafe(mount_name).ReferencesParent())
474 return std::string(); 474 return std::string();
475 root.append(mount_name); 475 root.append(net::EscapePath(mount_name));
476 root.append("/"); 476 root.append("/");
477 return root; 477 return root;
478 } 478 }
479 479
480 base::File::Error NetErrorToFileError(int error) { 480 base::File::Error NetErrorToFileError(int error) {
481 switch (error) { 481 switch (error) {
482 case net::OK: 482 case net::OK:
483 return base::File::FILE_OK; 483 return base::File::FILE_OK;
484 case net::ERR_ADDRESS_IN_USE: 484 case net::ERR_ADDRESS_IN_USE:
485 return base::File::FILE_ERROR_IN_USE; 485 return base::File::FILE_ERROR_IN_USE;
(...skipping 17 matching lines...) Expand all
503 return base::File::FILE_ERROR_ABORT; 503 return base::File::FILE_ERROR_ABORT;
504 case net::ERR_ADDRESS_INVALID: 504 case net::ERR_ADDRESS_INVALID:
505 case net::ERR_INVALID_URL: 505 case net::ERR_INVALID_URL:
506 return base::File::FILE_ERROR_INVALID_URL; 506 return base::File::FILE_ERROR_INVALID_URL;
507 default: 507 default:
508 return base::File::FILE_ERROR_FAILED; 508 return base::File::FILE_ERROR_FAILED;
509 } 509 }
510 } 510 }
511 511
512 } // namespace fileapi 512 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698