Repository navigation
Extend validator support to local links - #88
Merged
Merged
Conversation
bwplotka
reviewed
Jul 12, 2022
bwplotka
left a comment
Owner
There was a problem hiding this comment.
Thanks! Some idea first to check (:
| } | ||
|
|
||
| type IgnoreLocalValidator struct { | ||
| _regex *regexp.Regexp |
Owner
There was a problem hiding this comment.
Let's use exactly the same validator routines for local links, so we don't need to add any extra config bit.
Probably to ensure compatibility with current use cases, we might want to add special flag for it --enable-explicit-local-validators
Collaborator
Author
There was a problem hiding this comment.
Keeping it as a YAML config option instead, as we mention validators via that too. 🙂
Merged
1 of 5 tasks
saswatamcode
force-pushed
the
local-link-validator
branch
from
July 12, 2022 15:49
5427e24 to
0ec996c
Compare
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
saswatamcode
force-pushed
the
local-link-validator
branch
from
July 12, 2022 15:52
0ec996c to
2639800
Compare
bwplotka
approved these changes
Jul 12, 2022
bwplotka
left a comment
Owner
There was a problem hiding this comment.
LGTM, just one nit, not a blocker - feel free to merge.
| // RoundTripValidator.IsValid returns true if url is checked by colly or it is a valid local link. | ||
| func (v RoundTripValidator) IsValid(k futureKey, r *validator) (bool, error) { | ||
| matches := remoteLinkPrefixRe.FindAllStringIndex(k.dest, 1) | ||
| if matches == nil && r.validateConfig.ExplicitLocalValidators { |
Owner
There was a problem hiding this comment.
Does it make sense to pack it in separate function? Looks like 1:1 to repetition.
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
bwplotka
approved these changes
Jul 12, 2022
| return merr.Err() | ||
| } | ||
|
|
||
| func (v *validator) checkLocal(k futureKey) bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR extends validator support for local links.
Fixes #87.