[OpenNMS/opennms] 3c0b94: NMS-20246: Only treat images/ as local when it is ...
Scott Theleman via opennms-cvs <[email protected]>
| Newsgroups | gmane.network.opennms.cvs |
|---|---|
| Message-ID | <OpenNMS/opennms/push/refs/heads/jira/NMS-20246-test-for-static-assets/[email protected]> |
Branch: refs/heads/jira/NMS-20246-test-for-static-assets
Home: https://github.com/OpenNMS/opennms
Commit: 3c0b9485cbfcb8d09efb99d8f4657e977e5f438a
https://github.com/OpenNMS/opennms/commit/3c0b9485cbfcb8d09efb99d8f4657e977e5f438a
Author: Scott Theleman <[email protected]>
Date: 2026-08-19 (Wed, 19 Aug 2026)
Changed paths:
M opennms-webapp/src/test/java/org/opennms/web/StaticAssetReferenceTest.java
Log Message:
-----------
NMS-20246: Only treat images/ as local when it is a whole path segment
Review caught two false positives in the reference matcher, both confirmed
to fail the build on an otherwise unrelated commit:
<img src="https://cdn.example.com/images/x.png">
<img src="/opennms/custom-images/logo.png">
The first is served by another host and cannot be checked against the local
filesystem at all. The second is a different directory entirely, and was
reported as a missing images/logo.png -- a file nothing had referenced.
The matcher anchored on the literal text "images/" with nothing to its left,
so any path ending in that sequence matched and any prefix was discarded.
Rather than bolt a boundary assertion onto the regex, match the whole URL or
path token first and classify it afterwards by splitting on "/": a token is
a local webapp image only when "images" is an entire path segment followed
by a filename, and only when the token carries no scheme and is not
protocol-relative. That also covers the myimages/ and theme_images/ shapes,
which a left-boundary check on "-" alone would still have let through, and
it turns the existing assets/ exclusion into an ordinary segment comparison
instead of a lookbehind.
Add unit tests over the classifier for each case: the reference forms the
webapp actually uses, external and protocol-relative URLs, directories that
merely end in "images", assets/images, and tokens that are not image paths.
These run without touching the filesystem.
To unsubscribe from these emails, change your notification settings at https://github.com/OpenNMS/opennms/settings/notifications
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/wiki/index.php?page=MailingListFaq
opennms-cvs mailing list
To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-cvs