Add PERSIST_FLAGS_DONT_CHANGE_FILENAMES flag to prevent filename munging during composer upload. b=138832 r=brade@netscape.com sr=jaggernaut@netscape.com

This commit is contained in:
locka%iol.ie 2003-03-25 12:19:05 +00:00
Родитель ed1458b808
Коммит 8214c54221
3 изменённых файлов: 11 добавлений и 3 удалений

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

@ -973,6 +973,7 @@ function OutputFileWithPersistAPI(editorDoc, aDestinationLocation, aRelatedFiles
| webPersist.PERSIST_FLAGS_NO_BASE_TAG_MODIFICATIONS
| webPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES
| webPersist.PERSIST_FLAGS_DONT_FIXUP_LINKS
| webPersist.PERSIST_FLAGS_DONT_CHANGE_FILENAMES
| webPersist.PERSIST_FLAGS_FIXUP_ORIGINAL_DOM;
persistObj.saveDocument(editorDoc, aDestinationLocation, aRelatedFilesParentDir,
aMimeType, outputFlags, wrapColumn);

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

@ -58,10 +58,12 @@ interface nsIWebBrowserPersist : nsISupports
const unsigned long PERSIST_FLAGS_FIXUP_ORIGINAL_DOM = 128;
/** Fix links relative to destination location (not origin) */
const unsigned long PERSIST_FLAGS_FIXUP_LINKS_TO_DESTINATION = 256;
/** Don't do any adjustments to links */
/** Don't make any adjustments to links */
const unsigned long PERSIST_FLAGS_DONT_FIXUP_LINKS = 512;
/** Force serialization of output (one file at a time; not concurrent) */
const unsigned long PERSIST_FLAGS_SERIALIZE_OUTPUT = 1024;
/** Don't make any adjustments to filenames */
const unsigned long PERSIST_FLAGS_DONT_CHANGE_FILENAMES = 2048;
/**
* Flags governing how data is fetched and saved from the network.

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

@ -611,7 +611,7 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStartRequest(
if (data && data->mFile)
{
if (data->mCalcFileExt)
if (data->mCalcFileExt && !(mPersistFlags & PERSIST_FLAGS_DONT_CHANGE_FILENAMES))
{
// this is the first point at which the server can tell us the mimetype
CalculateAndAppendFileExt(data->mFile, channel, data->mOriginalLocation);
@ -1810,6 +1810,11 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename)
{
nsCAutoString nameFromURL;
url->GetFileName(nameFromURL);
if (mPersistFlags & PERSIST_FLAGS_DONT_CHANGE_FILENAMES)
{
fileName.AssignWithConversion(NS_UnescapeURL(nameFromURL).get());
goto end;
}
if (!nameFromURL.IsEmpty())
{
// Unescape the file name (GetFileName escapes it)
@ -1841,7 +1846,7 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename)
// Note: Filename could be empty at this point, but we'll deal with that
// problem later.
end:
aFilename = fileName;
return NS_OK;
}