Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hishamco
Copy link
Member

@hishamco hishamco commented Nov 8, 2024

No description provided.

Copy link
Contributor

github-actions bot commented Nov 8, 2024

This pull request has merge conflicts. Please resolve those before requesting a review.

Copy link
Member

@MikeAlhayek MikeAlhayek left a 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) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!resourcePath.StartsWith("//", StringComparison.OrdinalIgnoreCase) &&
!resourcePath.StartsWith("//", StringComparison.Ordinal) &&

[RequireFeatures("OrchardCore.Liquid")]
public sealed class ResourcesLiquidStartup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants