зеркало из https://github.com/mozilla/gecko-dev.git
Bug 912385 - Include a trailing slash in File.path. r=sicking
This commit is contained in:
Родитель
65c0ec4c40
Коммит
317a3d0b0b
|
@ -602,6 +602,9 @@ nsDOMFileFile::GetInternalStream(nsIInputStream **aStream)
|
|||
void
|
||||
nsDOMFileFile::SetPath(const nsAString& aPath)
|
||||
{
|
||||
MOZ_ASSERT(aPath.IsEmpty() ||
|
||||
aPath[aPath.Length() - 1] == PRUnichar('/'),
|
||||
"Path must end with a path separator");
|
||||
mPath = aPath;
|
||||
}
|
||||
|
||||
|
|
|
@ -375,9 +375,10 @@ public:
|
|||
nsAutoString leafName;
|
||||
mNextFile->GetLeafName(leafName);
|
||||
MOZ_ASSERT(leafName.Length() <= path.Length());
|
||||
int32_t length = path.Length() - leafName.Length() - 1; // -1 for "/"
|
||||
MOZ_ASSERT(length >= -1);
|
||||
int32_t length = path.Length() - leafName.Length();
|
||||
MOZ_ASSERT(length >= 0);
|
||||
if (length > 0) {
|
||||
// Note that we leave the trailing "/" on the path.
|
||||
domFile->SetPath(Substring(path, 0, uint32_t(length)));
|
||||
}
|
||||
*aResult = static_cast<nsIDOMFile*>(domFile.forget().get());
|
||||
|
|
|
@ -475,7 +475,8 @@ nsFSMultipartFormData::AddNameFilePair(const nsAString& aName,
|
|||
rv = file->GetPath(filepath16);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (!filepath16.IsEmpty()) {
|
||||
filename16 = filepath16 + NS_LITERAL_STRING("/") + filename16;
|
||||
// File.path includes trailing "/"
|
||||
filename16 = filepath16 + filename16;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче