OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |