Skip to content

V13: Add rcl files to static files tree#17671

Merged
kjac merged 7 commits intov13/devfrom
v13/bugfix/add-rcl-files-to-static-files-tree
Jan 9, 2025
Merged

V13: Add rcl files to static files tree#17671
kjac merged 7 commits intov13/devfrom
v13/bugfix/add-rcl-files-to-static-files-tree

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
@Zeegaan Zeegaan requested a review from kjac January 6, 2025 10:08
Copy link
Contributor

@kjac kjac left a comment

Choose a reason for hiding this comment

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

Works like a charm! 🚀

@kjac kjac merged commit 4a54215 into v13/dev Jan 9, 2025
14 of 15 checks passed
@kjac kjac deleted the v13/bugfix/add-rcl-files-to-static-files-tree branch January 9, 2025 08:36
Zeegaan added a commit that referenced this pull request Jan 9, 2025
* Refactor to use IWebhostEnvironment for wwwroot files.

* Obsolete ctor

* Add ActivatorUtiiliesConstructor

* Refactor logic to include folders

* Fix so we can see files in wwwroot/App_Plugins

* Cosmetic: Use invariant comparison for the "umbraco" folder".

---------

Co-authored-by: kjac <kja@umbraco.dk>
@Zeegaan
Copy link
Member Author

Zeegaan commented Jan 9, 2025

Cherry picked for 13.6 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants