Skip to content

Commit 8815343

Browse files
committed
Do not validate for http:// URLs in elements and attributes that are definitiely part of a different namespace
Since the XML parser does not seem to have much support at all for namespaces, this fix is very ... raw in that it only looks for a namespace delimintor `:` and if we find that in a element, mark it as ok. If we find it in an attribute, do not check it. This fixes #2093
1 parent 49043b7 commit 8815343

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tools/packchk/src/CheckFiles.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ bool CheckFiles::CheckDescription(RteItem* item)
241241
*/
242242
bool CheckFiles::CheckUrls(RteItem* item)
243243
{
244-
if(!item || item->GetTag() == "package") {
244+
if(!item || item->GetTag() == "package" || item->GetTag().find(":", 0) != string::npos) {
245245
return true;
246246
}
247247

@@ -255,6 +255,9 @@ bool CheckFiles::CheckUrls(RteItem* item)
255255

256256
const auto& attributes = item->GetAttributes();
257257
for(const auto& [attr, text] : attributes) {
258+
if(attr.find(":", 0) != string::npos) {
259+
continue;
260+
}
258261
if(text.find("http://", 0) != string::npos) {
259262
LogMsg("M300", TAG(attr), URL("https://"), lineNo);
260263
bOk = false;

tools/packchk/test/data/TestUrlHttps/TestVendor.TestUrlHttps.pdsc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@
4747
<subFamily DsubFamily="MyDevice">
4848
<device Dname="MyDeviceM0">
4949
<processor Dfpu="0" Dmpu="0" Dendian="Little-endian" Dclock="24000000"/>
50+
<environment name="microchip">
51+
<mchp:extension xmlns:mchp="http://crownking/pack-device-microchip-extension"
52+
schemaVersion="1.0"
53+
xsi:schemaLocation="http://crownking/pack-device-microchip-extension PACK.DEVICE.MICROCHIP.EXTENSION.xsd"><!--https://schemas.microchip.com/com/microchip/packs/extensions/mchp/1.0/PACK.DEVICE.MICROCHIP.EXTENSION.xsd-->
54+
<mchp:prerequisite component="MPLAB X IDE" version="[5.10-"/>
55+
</mchp:extension>
56+
</environment>
5057
</device>
5158
</subFamily>
5259
</family>

0 commit comments

Comments
 (0)