@@ -275,8 +275,17 @@ void QgsEditFormConfig::readXml( const QDomNode &node, QgsReadWriteContext &cont
275
275
if ( !editFormNode.isNull () )
276
276
{
277
277
QDomElement e = editFormNode.toElement ();
278
+ const bool tolerantRemoteUrls = e.hasAttribute ( QStringLiteral ( " tolerant" ) );
278
279
if ( !e.text ().isEmpty () )
279
- setUiForm ( context.pathResolver ().readPath ( e.text () ) );
280
+ {
281
+ const QString uiFormPath = context.pathResolver ().readPath ( e.text () );
282
+ // <= 3.2 had a bug where invalid ui paths would get written into projects on load
283
+ // to avoid restoring these invalid paths, we take a less-tolerant approach for older (untrustworthy) projects
284
+ // and only set ui forms paths IF they are local files OR start with "http(s)".
285
+ const bool localFile = QFileInfo::exists ( uiFormPath );
286
+ if ( localFile || tolerantRemoteUrls || uiFormPath.startsWith ( QStringLiteral ( " http" ) ) )
287
+ setUiForm ( uiFormPath );
288
+ }
280
289
}
281
290
282
291
QDomNode editFormInitNode = node.namedItem ( QStringLiteral ( " editforminit" ) );
@@ -404,6 +413,7 @@ void QgsEditFormConfig::writeXml( QDomNode &node, const QgsReadWriteContext &con
404
413
QDomDocument doc ( node.ownerDocument () );
405
414
406
415
QDomElement efField = doc.createElement ( QStringLiteral ( " editform" ) );
416
+ efField.setAttribute ( QStringLiteral ( " tolerant" ), QStringLiteral ( " 1" ) );
407
417
QDomText efText = doc.createTextNode ( context.pathResolver ().writePath ( uiForm () ) );
408
418
efField.appendChild ( efText );
409
419
node.appendChild ( efField );
0 commit comments