This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/master by this push:
new b94b2a8 fix: null reference in relative link rule
b94b2a8 is described below
commit b94b2a857e17d8c6f091760d8ec2129f803dccff
Author: Zoran Regvart <[email protected]>
AuthorDate: Mon Nov 2 18:55:46 2020 +0100
fix: null reference in relative link rule
---
rules.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/rules.js b/rules.js
index a76c7d6..f5cd1e2 100644
--- a/rules.js
+++ b/rules.js
@@ -35,9 +35,13 @@ class RelativeLinks extends Rule {
setup() {
this.on("dom:ready", event => {
- event.document.querySelectorAll('a').forEach(a => {
- const href = a.getAttribute("href").value;
- if (href && href.startsWith("https://camel.apache.org")) {
+ const anchors = event.document.querySelectorAll('a');
+ if (anchors === null) {
+ return;
+ }
+ anchors.forEach(a => {
+ const href = a.getAttribute("href");
+ if (href && href.value.startsWith("https://camel.apache.org")) {
this.report(a, `For links within camel.apache.org use relative
links, found: ${href}`);
}
});