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

V13: Add rcl files to static files tree #17671

Open
wants to merge 2 commits into
base: v13/dev
Choose a base branch
from

Conversation

Zeegaan
Copy link
Member

@Zeegaan Zeegaan commented Nov 28, 2024

Fixes #15956

Notes

  • This refactors the StaticFilesTreeController to now use IWebhostEnvironment to get wwwroot files, this will then also get files from RCLs.
  • Some logic to now go over:
  • If path is empty, we assume we are "just" asking for the root folders "wwwroot" & appplugins,
    This was the business logic before, and was filtered by this code if (id == Constants.System.RootString && directory != AppPlugins && directory != Webroot)
  • If we want files from the AppPlugins director, we still want to use the IPhysicalFileSystem, so the behavior will remain, as you cannot put RCL files in there. (It has to be in wwwroot)
  • If we want files from wwwroot folder, then we now use IWebHostEnvironment.WebRootFileProvider, but the path is a little weird here, so we have to recalculate, as when you pass in "" in the .GetDirectories, this will assume you are already in /wwwroot
  • This logic should probably be in a service, and will be refactored for 14+ to be in a service ala something like StaticFilesService

How to test

  • Follow steps in original issue.
  • When creating a RCL with HTML file in the wwwroot folder, here is my csproj from my test project:
<Project Sdk="Microsoft.NET.Sdk.Razor">
  <PropertyGroup>
    <Title>TestProj</Title>
    <Description>Adds support for Entity Framework Core to Umbraco CMS.</Description>
    <EnablePackageValidation>false</EnablePackageValidation>
    <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
    <StaticWebAssetBasePath>/</StaticWebAssetBasePath>
  </PropertyGroup>
</Project>

@Zeegaan Zeegaan marked this pull request as ready for review November 29, 2024 09:22
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.

1 participant