feat!: implement "splicing" for --base-url + --root-dir#3
Draft
katrinafyi wants to merge 65 commits intomasterfrom
Draft
feat!: implement "splicing" for --base-url + --root-dir#3katrinafyi wants to merge 65 commits intomasterfrom
--base-url + --root-dir#3katrinafyi wants to merge 65 commits intomasterfrom
Conversation
maybe we can make it work if we get rid of Cow. if it's only run once per input, then that should be fast enough
fe5d574 to
9c64368
Compare
Conflicts: .github/workflows/ci.yml lychee-bin/src/options.rs lychee-lib/src/collector.rs lychee-lib/src/types/base.rs lychee-lib/src/utils/request.rs
Conflicts: README.md lychee-bin/src/options.rs lychee-bin/tests/cli.rs lychee-lib/src/collector.rs lychee-lib/src/types/input/source.rs lychee-lib/src/utils/request.rs
Author
|
need to fix https://github.com/rina-forks/lychee/pull/3/files#diff-91c9664581cb134f51a915a79781a5762de37142f67349f59060d277c0dc3a71R35 so it more strictly ensures a subpath relation lychee/lychee-lib/src/utils/url.rs Lines 35 to 41 in 15fc377 |
Conflicts: lychee-lib/src/collector.rs lychee-lib/src/utils/request.rs
Conflicts: lychee-lib/src/collector.rs
Conflicts: lychee-bin/src/options.rs
…???? what counts as a "subpath" of a URL with filename? what makes sense is to ignore the filename semantics and just use "file path semantics". so /a JOIN b would be /a/b. but this causes problems when we use URL operations which do URL joining.
Author
|
problems with base-url:
if directory base url, then go as normal. if file base url, then the only subpath is the file itself. |
can we bundle these two things together somehow????????? maybe we just hoist the SourceBaseInfo up so there's fewer Path/Base things and less drilling of root_and_base. in fact, UrlMappings can be constant for an entire run. SourceBaseInfo is per source. how can we deal with fallback and mapping nicely??? fallback and mapping both affect the preparation and the parsing
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.
when both
--base-urland--root-dirare given, this implements the behaviour described in https://www.github.com/lycheeverse/lychee/issues/1718#issuecomment-3170382677. i've taken to calling this "splicing".lychee/README.md
Lines 548 to 595 in ff72bd6
this gives a sensible interpretation when both flags are used together, enabling uses like this example from the docs:
this significantly changes the meaning of
--base-url, introducing an association between--base-urland--root-dir. the base-url option now requires root-dir in order to know which directory to map to base-url.something like the previous base-url behaviour is provided in
--fallback-base-url, though it differs in some ways. in particular, it applies in slightly fewer situations; it does not apply where a more canonical base-url is available (see help).--root-dir, when specified alone, is unchanged.
see also: full options help for the new options
notes for the reviewer:
todo: