-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move AppendVersion & ResourceUrl filters to OC.Resources #16973
base: main
Are you sure you want to change the base?
Conversation
This pull request has merge conflicts. Please resolve those before requesting a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what is the reason for this PR. But, I think this PR would be part of a bigger change otherwise it's not useful.
// Don't evaluate with Uri.TryCreate as it produces incorrect results on Linux. | ||
!resourcePath.StartsWith("https://", StringComparison.OrdinalIgnoreCase) && | ||
!resourcePath.StartsWith("http://", StringComparison.OrdinalIgnoreCase) && | ||
!resourcePath.StartsWith("//", StringComparison.OrdinalIgnoreCase) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!resourcePath.StartsWith("//", StringComparison.OrdinalIgnoreCase) && | |
!resourcePath.StartsWith("//", StringComparison.Ordinal) && |
[RequireFeatures("OrchardCore.Liquid")] | ||
public sealed class ResourcesLiquidStartup : StartupBase | ||
{ | ||
public override void ConfigureServices(IServiceCollection services) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think this is the right approach. If you look at line 24, you’ll see that we’re always registering Liquid-related services without needing to explicitly check for OrchardCore.Liquid
. This is because Liquid support is automatically included when .AddOrchardCms()
is called in the web project. In other words, the Liquid services are available even if OrchardCore.Liquid
is not explicitly enabled.
A better solution would be to introduce a new feature, OrchardCore.Liquid.Core
, which would register the necessary Liquid services. This feature would be enabled through dependencies and could be used in the current context. We can then move all Liquid-related configuration into a new startup class dedicated to this feature. This approach would allow us to cleanly encapsulate the registration of Liquid services, as shown here: Liquid Service Registration.
Furthermore, the current line here would be replaced with .AddGlobalFeatures("OrchardCore.Liquid.Core")
.
This would simplify the code and improve modularity, ensuring that Liquid services are only registered when the new feature is explicitly enabled.
No description provided.