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

Issue finding template on Linux #84

Open
peterkeating opened this issue Nov 26, 2024 · 3 comments
Open

Issue finding template on Linux #84

peterkeating opened this issue Nov 26, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@peterkeating
Copy link

Which Umbraco.Community.BlockPreview version are you using?

1.10.5

Which Umbraco version are you using? For example: 10.4.0 - don't just write v10

13.5.2

Bug summary

Our templates use pascal case for template filenames (e.g. "VideoBlock.cshtml") which works well when Umbraco is hosted on Windows, however on Linux we've see an issue with finding the template likely due to trying to find the template using the alias without pascal casing. Looking at the code within this repository I can see the two different cases ("videoBlock.cshtml" & "VideoBlock.cshtml") are being checked, however I think the problem is instead of IRazorViewEngine returning a ViewEngineResult with Success as false, an exception is being thrown, stack trace shown below.

System.IO.FileNotFoundException: Could not find file '/Release/Views/Partials/blockgrid/Components/videoBlock.cshtml'.
File name: '/Release/Views/Partials/blockgrid/Components/videoBlock.cshtml'
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFileInfo.CreateReadStream()
   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.FileProviderRazorProjectItem.Read()
   at Microsoft.AspNetCore.Razor.Language.RazorSourceDocument.ReadFrom(RazorProjectItem projectItem)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorProjectEngine.CreateCodeDocumentCore(RazorProjectItem projectItem, Action`1 configureParser, Action`1 configureCodeGeneration)
   at Microsoft.AspNetCore.Razor.Language.DefaultRazorProjectEngine.CreateCodeDocumentCore(RazorProjectItem projectItem)
   at Microsoft.AspNetCore.Razor.Language.RazorProjectEngine.Process(RazorProjectItem projectItem)
   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.RuntimeViewCompiler.CompileAndEmit(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.RuntimeViewCompiler.OnCacheMiss(String normalizedPath)
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Razor.Compilation.DefaultRazorPageFactoryProvider.CreateFactory(String relativePath)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.CreateCacheResult(HashSet`1 expirationTokens, String relativePath, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.LocatePageFromPath(String executingFilePath, String pagePath, Boolean isMainPage)
   at Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine.GetView(String executingFilePath, String viewPath, Boolean isMainPage)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.GetViewResult(String contentAlias, BlockType blockType)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.GetMarkupFromPartial(ControllerContext controllerContext, ViewDataDictionary viewData, String contentAlias, BlockType blockType)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.GetMarkup(ControllerContext controllerContext, String contentAlias, ViewDataDictionary viewData, BlockType blockType)
   at Umbraco.Community.BlockPreview.Services.BlockPreviewService.RenderGridBlock(BlockValue blockData, ControllerContext controllerContext, String blockEditorAlias, Guid documentTypeUnique, String contentUdi, String settingsUdi)
   at Umbraco.Community.BlockPreview.Controllers.BlockPreviewApiController.PreviewGridBlock(BlockValue blockData, Guid nodeKey, String blockEditorAlias, String contentElementAlias, String culture, Guid documentTypeKey, String contentUdi, String settingsUdi)

Steps to reproduce

  • Change view template filenames to use pascal casing
  • View block grid editor within Backoffice within a Linux environment
  • See error suggesting the view template can't be found

Expected result / actual result

Block grid editor would find the template and render a preview.

@peterkeating peterkeating added the bug Something isn't working label Nov 26, 2024
@rickbutterfield
Copy link
Owner

Thanks for raising @peterkeating! I've already started to work on this, and a fix is coming soon.

rickbutterfield added a commit that referenced this issue Nov 28, 2024
@rickbutterfield
Copy link
Owner

@peterkeating A fix for this has been included in 1.11.0, please give it a go and report back!

@peterkeating
Copy link
Author

@rickbutterfield Thanks for this! I'll try to take a look and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants