refactor!: remove Base::Local and use file:// base URLs instead #1983
+215
−104
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 is mostly a behind-the-scenes refactor, but it has a minor behaviour change when a local base URL is used with root dir. You can see the changes in this test case: 9ecf455.
I cannot tell if this would be a positive or negative change, or whether it would be okay to make. It does bring the local base URL behaviour more in line with remote base URL, with root-dir being injected directly after the base URL.
Of course, it will also be a breaking change for users of lychee-lib.
Removing Base::Local means that some special code paths handling local bases can be removed. This fixes some odd bugs that happened with local bases and not with remote bases.
The functionality of local bases is still available through a file:// "remote" base. The Base::try_from function smooths this over by detecting strings which look like absolute paths and mapping these to file:// URLs. There is a new utils::url::parse_url_or_path helper function to help with this.
Fixes #1896
This doesn't need to be merged if you don't want to