Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-link-inspector</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.exadel.etoolbox</groupId>
<artifactId>etoolbox-link-inspector</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>etoolbox-link-inspector.core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class InternalLinkResolverImpl implements Resolver {

private String internalLinksHost;
private boolean enabled;
private boolean checkAsExternal;

@Reference
private Resolver externalLinkResolver;
Expand All @@ -66,6 +67,7 @@ public class InternalLinkResolverImpl implements Resolver {
private void activate(InternalLinkResolverConfig config) {
this.enabled = config.enabled();
this.internalLinksHost = config.internalLinksHost();
this.checkAsExternal = config.checkAsExternal();
}

/**
Expand Down Expand Up @@ -102,7 +104,7 @@ public void validate(Result result, ResourceResolver resourceResolver) {
return;
}
Status status = checkLink(result.getValue(), resourceResolver);
if (status.getCode() == HttpStatus.SC_NOT_FOUND && StringUtils.isNotBlank(internalLinksHost)) {
if ((status.getCode() == HttpStatus.SC_NOT_FOUND || checkAsExternal) && StringUtils.isNotBlank(internalLinksHost)) {
String prefix = StringUtils.startsWithAny(internalLinksHost, HTTP_SCHEMA, HTTPS_SCHEMA) ? EMPTY : HTTPS_SCHEMA;
String origin = StringUtils.stripEnd(internalLinksHost, "/");
SlingUriBuilder slingUri = SlingUriBuilder.parse(result.getValue(), resourceResolver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
)
boolean enabled() default true;

@AttributeDefinition(
name = "Check Internal Links over Network",
description = "Check internal links by sending network requests. Internal links host should be specified for this to work properly"
)
boolean checkAsExternal() default false;

@AttributeDefinition(
name = "Internal Links Host",
description = "Host to be used for verifying internal links. " +
Expand Down

This file was deleted.

Loading