зеркало из https://github.com/mozilla/pjs.git
Unescape FTP names (in case they were encoded).
This commit is contained in:
Родитель
6555410913
Коммит
4418e22473
|
@ -42,6 +42,8 @@
|
||||||
#include "prio.h"
|
#include "prio.h"
|
||||||
#include "rdf.h"
|
#include "rdf.h"
|
||||||
|
|
||||||
|
#include "nsEscape.h"
|
||||||
|
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#ifdef NECKO
|
#ifdef NECKO
|
||||||
#include "nsIEventQueueService.h"
|
#include "nsIEventQueueService.h"
|
||||||
|
@ -371,11 +373,12 @@ FTPDataSource::GetURL(nsIRDFResource *source, nsIRDFLiteral** aResult)
|
||||||
NS_METHOD
|
NS_METHOD
|
||||||
FTPDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral** aResult)
|
FTPDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral** aResult)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
nsXPIDLCString uri;
|
nsXPIDLCString uri;
|
||||||
rv = source->GetValue( getter_Copies(uri) );
|
rv = source->GetValue( getter_Copies(uri) );
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv))
|
||||||
|
return(rv);
|
||||||
|
|
||||||
nsAutoString url(uri);
|
nsAutoString url(uri);
|
||||||
|
|
||||||
|
@ -388,6 +391,7 @@ FTPDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral** aResult)
|
||||||
url.Cut(len-1, 1);
|
url.Cut(len-1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get basename
|
// get basename
|
||||||
PRInt32 slash = url.RFind('/');
|
PRInt32 slash = url.RFind('/');
|
||||||
if (slash > 0)
|
if (slash > 0)
|
||||||
|
@ -395,14 +399,26 @@ FTPDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral** aResult)
|
||||||
url.Cut(0, slash+1);
|
url.Cut(0, slash+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX To Do: unescape basename
|
// unescape basename
|
||||||
|
rv = NS_ERROR_NULL_POINTER;
|
||||||
nsIRDFLiteral *literal;
|
char *basename = url.ToNewCString();
|
||||||
rv = gRDFService->GetLiteral(url.GetUnicode(), &literal);
|
if (basename)
|
||||||
if (NS_FAILED(rv)) return rv;
|
{
|
||||||
|
basename = nsUnescape(basename);
|
||||||
|
if (basename)
|
||||||
|
{
|
||||||
|
url = basename;
|
||||||
|
delete [] basename;
|
||||||
|
basename = nsnull;
|
||||||
|
|
||||||
*aResult = literal;
|
nsIRDFLiteral *literal;
|
||||||
return NS_OK;
|
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(url.GetUnicode(), &literal)))
|
||||||
|
{
|
||||||
|
*aResult = literal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче