apache / apache/cordova-common
TypeError: Cannot read properties of undefined (reading 'path') when config-file present in config.xml
- Dominant language
- JavaScript
- Stars
- 42
- Forks
- 45
- Avg merge
- 5h 41m
- Merged PRs (30d)
- 6
Description
# 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
```
```
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`.
Contributor guide
Research direction
Start with ConfigChanges.prototype._is_conflicting and the config-file example in config.xml, then reproduce the failure with cordova build android. Check how config-file uses target and parent compared with edit-config, and consider the issue done when the example no longer crashes with a null path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100