Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
update also htmlToMarkdown in the crash report fix #31629
  • Loading branch information
Gustry authored and nyalldawson committed Mar 30, 2020
1 parent a6113f0 commit 55ca2a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/qgsstringutils.cpp
Expand Up @@ -556,7 +556,7 @@ QString QgsStringUtils::insertLinks( const QString &string, bool *foundLinks )

QString QgsStringUtils::htmlToMarkdown( const QString &html )
{

// Any changes in this function must be copied to qgscrashreport.cpp too
QString converted = html;
converted.replace( QLatin1String( "<br>" ), QLatin1String( "\n" ) );
converted.replace( QLatin1String( "<b>" ), QLatin1String( "**" ) );
Expand All @@ -567,7 +567,7 @@ QString QgsStringUtils::htmlToMarkdown( const QString &html )
while ( hrefRegEx.indexIn( converted, offset ) != -1 )
{
QString url = hrefRegEx.cap( 1 ).replace( QStringLiteral( "\"" ), QString() );
url.replace( QStringLiteral( "'" ), QString() );
url.replace( '\'', QString() );
QString name = hrefRegEx.cap( 2 );
QString anchor = QStringLiteral( "[%1](%2)" ).arg( name, url );
converted.replace( hrefRegEx, anchor );
Expand Down
2 changes: 2 additions & 0 deletions src/crashhandler/qgscrashreport.cpp
Expand Up @@ -171,6 +171,7 @@ QString QgsCrashReport::crashReportFolder()

QString QgsCrashReport::htmlToMarkdown( const QString &html )
{
// Any changes in this function must be copied to qgsstringutils.cpp too
QString converted = html;
converted.replace( QLatin1String( "<br>" ), QLatin1String( "\n" ) );
converted.replace( QLatin1String( "<b>" ), QLatin1String( "**" ) );
Expand All @@ -181,6 +182,7 @@ QString QgsCrashReport::htmlToMarkdown( const QString &html )
while ( hrefRegEx.indexIn( converted, offset ) != -1 )
{
QString url = hrefRegEx.cap( 1 ).replace( QStringLiteral( "\"" ), QString() );
url.replace( '\'', QString() );
QString name = hrefRegEx.cap( 2 );
QString anchor = QStringLiteral( "[%1](%2)" ).arg( name, url );
converted.replace( hrefRegEx, anchor );
Expand Down

0 comments on commit 55ca2a4

Please sign in to comment.