Bug 214405 - Unable to ftp virtual folder. r=jduell, sr=cbiesinger

This commit is contained in:
Michal Novotny 2009-09-21 19:57:36 +02:00
Родитель 95b9cffb5a
Коммит 6d65c4d555
2 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -1507,7 +1507,7 @@ nsFtpState::R_pasv() {
mDataStream = do_QueryInterface(input);
}
if (mRETRFailed)
if (mRETRFailed || (!mPath.IsEmpty() && mPath.Last() == '/'))
return FTP_S_CWD;
return FTP_S_SIZE;
}

Просмотреть файл

@ -899,6 +899,13 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
NS_ConvertUTF16toUTF8 utf8UnEscapeSpec(unEscapeSpec);
// Adding trailing slash helps to recognize whether the URL points to a file
// or a directory (bug #214405).
if ((type == nsIDirIndex::TYPE_DIRECTORY) &&
(utf8UnEscapeSpec.Last() != '/')) {
utf8UnEscapeSpec.Append('/');
}
// now minimally re-escape the location...
PRUint32 escFlags;
// for some protocols, like gopher, we expect the location to be absolute.
@ -911,10 +918,9 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
}
else {
// escape as relative
// esc_Directory is needed for protocols which allow the same name for
// both a directory and a file and distinguish between the two by a
// trailing '/' -- without it, the trailing '/' will be escaped, and
// links from within that directory will be incorrect
// esc_Directory is needed because directories have a trailing slash.
// Without it, the trailing '/' will be escaped, and links from within
// that directory will be incorrect
escFlags = esc_Forced | esc_OnlyASCII | esc_AlwaysCopy | esc_FileBaseName | esc_Colon | esc_Directory;
}
NS_EscapeURL(utf8UnEscapeSpec.get(), utf8UnEscapeSpec.Length(), escFlags, escapeBuf);