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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95582
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-09-20 John Gregg <johnnyg@google.com>
+
+ 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 <jochen@chromium.org>
Invoke CachedResourceLoader::canRequest for all URLs in a redirect chain
{'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"));
doTest(testFileList1);
doTest(testFileList2);
doTest(testFileList3);
- doTest(testFileList4, true);
+ doTest(testFileList4);
+ doTest(testFileList5, true);
}
</script>
</body>
+2011-09-20 John Gregg <johnnyg@google.com>
+
+ 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 <jochen@chromium.org>
Invoke CachedResourceLoader::canRequest for all URLs in a redirect chain
}
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;