Skip to content

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

@NoLongerBreathedIn

Description

@NoLongerBreathedIn

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

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions