MDict: ltrim unprintable characters from filename

This commit is contained in:
Timon Wong 2013-04-26 11:35:00 +08:00 committed by Tvangeste
parent 3154e32afc
commit 58654a7423

6
mdx.cc
View file

@ -795,10 +795,12 @@ string MdxDictionary::filterResource( const char * articleId, const char * artic
QString::fromStdString( addAudioLink( "\"gdau://" + getId() + "/\\2\"", getId() ) ) +
"\\1gdau://" + QString::fromStdString( getId() ) + "/\\2" )
// stylesheets
.replace( QRegExp( "(<\\s*link\\s+[^>]*href\\s*=\\s*[\"']+)(file://)?([^\"']*)", Qt::CaseInsensitive ),
.replace( QRegExp( "(<\\s*link\\s+[^>]*href\\s*=\\s*[\"']+)(file://)?[\\x00-\\x30\\x7f]*([^\"']*)",
Qt::CaseInsensitive, QRegExp::RegExp2 ),
"\\1bres://" + QString::fromStdString( getId() ) + "/\\3" )
// images
.replace( QRegExp( "(<\\s*img\\s+[^>]*src\\s*=\\s*[\"']+)(file://)?([^\"']*)", Qt::CaseInsensitive ),
.replace( QRegExp( "(<\\s*img\\s+[^>]*src\\s*=\\s*[\"']+)(file://)?[\\x00-\\x30\\x7f]*([^\"']*)",
Qt::CaseInsensitive, QRegExp::RegExp2 ),
"\\1bres://" + QString::fromStdString( getId() ) + "/\\3" )
.toUtf8().constData() );
}