Title: [95582] trunk
- Revision
- 95582
- Author
- [email protected]
- Date
- 2011-09-20 16:49:19 -0700 (Tue, 20 Sep 2011)
Log Message
Directory Upload: parent path can truncate first char of the correct path
https://bugs.webkit.org/show_bug.cgi?id=66695
Source/WebCore:
In some cases, if the parent path we compute ends with a separator
character like '/' or 'C:\', by adding one in an attempt to grab the
subsequent separator we actually grab a character of the real path,
which is incorrect.
Reviewed by Darin Fisher.
* html/FileInputType.cpp:
(WebCore::FileInputType::setFileList):
LayoutTests:
Add a test case for when the parent path is '/'.
Reviewed by Darin Fisher.
* fast/forms/input-file-directory-upload.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (95581 => 95582)
--- trunk/LayoutTests/ChangeLog 2011-09-20 23:43:26 UTC (rev 95581)
+++ trunk/LayoutTests/ChangeLog 2011-09-20 23:49:19 UTC (rev 95582)
@@ -1,3 +1,14 @@
+2011-09-20 John Gregg <[email protected]>
+
+ Directory Upload: parent path can truncate first char of the correct path
+ https://bugs.webkit.org/show_bug.cgi?id=66695
+
+ Add a test case for when the parent path is '/'.
+
+ Reviewed by Darin Fisher.
+
+ * fast/forms/input-file-directory-upload.html:
+
2011-09-20 Jochen Eisinger <[email protected]>
Invoke CachedResourceLoader::canRequest for all URLs in a redirect chain
Modified: trunk/LayoutTests/fast/forms/input-file-directory-upload.html (95581 => 95582)
--- trunk/LayoutTests/fast/forms/input-file-directory-upload.html 2011-09-20 23:43:26 UTC (rev 95581)
+++ trunk/LayoutTests/fast/forms/input-file-directory-upload.html 2011-09-20 23:49:19 UTC (rev 95582)
@@ -31,6 +31,12 @@
{'path': 'resources/dirupload/path1/subpath1/file1', 'expect-relpath': 'path1/subpath1/file1' },
];
+var testFileList5 = [
+ {'path': '/foo/baz', 'expect-relpath': 'foo/baz'},
+ {'path': '/foo/bar/baz', 'expect-relpath': 'foo/bar/baz'},
+ {'path': '/foo2/baz', 'expect-relpath': 'foo2/baz'},
+];
+
function log(message)
{
document.getElementById('output').appendChild(document.createTextNode(message + "\n"));
@@ -71,7 +77,8 @@
doTest(testFileList1);
doTest(testFileList2);
doTest(testFileList3);
- doTest(testFileList4, true);
+ doTest(testFileList4);
+ doTest(testFileList5, true);
}
</script>
</body>
Modified: trunk/Source/WebCore/ChangeLog (95581 => 95582)
--- trunk/Source/WebCore/ChangeLog 2011-09-20 23:43:26 UTC (rev 95581)
+++ trunk/Source/WebCore/ChangeLog 2011-09-20 23:49:19 UTC (rev 95582)
@@ -1,3 +1,18 @@
+2011-09-20 John Gregg <[email protected]>
+
+ Directory Upload: parent path can truncate first char of the correct path
+ https://bugs.webkit.org/show_bug.cgi?id=66695
+
+ In some cases, if the parent path we compute ends with a separator
+ character like '/' or 'C:\', by adding one in an attempt to grab the
+ subsequent separator we actually grab a character of the real path,
+ which is incorrect.
+
+ Reviewed by Darin Fisher.
+
+ * html/FileInputType.cpp:
+ (WebCore::FileInputType::setFileList):
+
2011-09-20 Jochen Eisinger <[email protected]>
Invoke CachedResourceLoader::canRequest for all URLs in a redirect chain
Modified: trunk/Source/WebCore/html/FileInputType.cpp (95581 => 95582)
--- trunk/Source/WebCore/html/FileInputType.cpp 2011-09-20 23:43:26 UTC (rev 95581)
+++ trunk/Source/WebCore/html/FileInputType.cpp 2011-09-20 23:49:19 UTC (rev 95582)
@@ -241,9 +241,12 @@
}
rootPath = directoryName(rootPath);
ASSERT(rootPath.length());
+ int rootLength = rootPath.length();
+ if (rootPath[rootLength - 1] != '\\' && rootPath[rootLength - 1] != '/')
+ rootLength += 1;
for (size_t i = 0; i < size; i++) {
// Normalize backslashes to slashes before exposing the relative path to script.
- String relativePath = paths[i].substring(1 + rootPath.length()).replace('\\', '/');
+ String relativePath = paths[i].substring(rootLength).replace('\\', '/');
m_fileList->append(File::createWithRelativePath(paths[i], relativePath));
}
return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes