Fix for bug #308996; get mime-type to fe_URLToLocalName so file is saved with proper extension

This commit is contained in:
law%netscape.com 1998-10-08 21:14:01 +00:00
Родитель 81a9f7a466
Коммит d22b69be29
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -24,6 +24,7 @@
#include "cxsave.h"
#include "extgen.h"
#include "intl_csi.h"
#include "netcache.h"
#ifdef _DEBUG
#undef THIS_FILE
@ -529,9 +530,20 @@ BOOL CSaveCX::CanCreate(URL_Struct* pUrl)
if (!IsSavingToGlobal()) {
// Query for a filename if we don't have one already
if(m_csFileName.IsEmpty()) {
// If not provided, try to acquire URL struct.
BOOL bAcquiredUrl = FALSE;
if ( !pUrl ) {
// Try to get URL struct from cache.
pUrl = NET_CreateURLStruct(m_csAnchor, NET_DONT_RELOAD);
if ( pUrl ) {
NET_FindURLInCache(pUrl, GetContext());
bAcquiredUrl = TRUE;
}
}
#ifdef MOZ_MAIL_NEWS
char * pSuggested = MimeGuessURLContentName(GetContext(),m_csAnchor);
// get the mime content type
if (pSuggested && *pSuggested) {
// check if the file doesn't have an extension
@ -549,6 +561,12 @@ BOOL CSaveCX::CanCreate(URL_Struct* pUrl)
XP_FREE(pSuggested);
}
// Free URL struct if we acquired it.
if ( bAcquiredUrl ) {
NET_FreeURLStruct(pUrl);
pUrl = 0;
}
if(pUserName == NULL) {
DestroyContext();
return(FALSE);