cordova-common icon indicating copy to clipboard operation
cordova-common copied to clipboard

TypeError: Cannot read properties of undefined (reading 'path') when config-file present in config.xml

Open NoLongerBreathedIn opened this issue 11 months ago • 2 comments

Bug Report

Problem

ConfigChanges.prototype.add_config_changes crashes if you have any config-file elements in your config.xml.

What is expected to happen?

It handles it properly.

What does actually happen?

It crashes with an error saying that a path was null.

Information

Command or Code

<config-file target="AndroidManifest.xml" mode="merge" parent="/manifest/application/activity"
             xmlns:android="http://schemas.android.com/apk/res/android" platform="android">
	<intent-filter>
		<action android:name="android.media.action.IMAGE_CAPTURE"/>
	</intent-filter>
</config-file>

and cordova build android crashes

Environment, Platform, Device

Windows 10 or 11 (not sure), compiling for Android.

Version information

cordova-common 5.0.0

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

Misc notes:

This did not occur on 4.0.2, for unclear reasons.

To fix this, the best way of changing this is to edit ConfigChanges.prototype._is_conflicting to deal with the way that config-file entries use target - basically, they use target where edit-config uses file and parent where edit-config uses target.

NoLongerBreathedIn avatar Jan 06 '25 20:01 NoLongerBreathedIn

Hi! I’d like to work on this issue. Could you please assign it to me?

Thanks!

Charul192 avatar Jul 26 '25 08:07 Charul192

Hi! I’d like to work on this issue. Could you please assign it to me?

Thanks!

PRs are welcome, regardless of the assigned user.

breautek avatar Jul 29 '25 14:07 breautek