App_Plugins not visible in blocklist stylesheet
# help-with-umbraco
d
Hi, I'm working on an Umbraco 10 website that was upgraded from Umbraco 8. Unlike other Umbraco 10 sites, this site does not allow me to select a custom stylesheet from App_Plugins folder. Nor does it allow me to select a custom view from the App_Plugins folder. The App_Plugins folder simply doesn't show up in the panel (see image). Does anyone know why it won't show up? I have confirmed that the App_Plugins folder does exist and all items in the App_Plugins folder are set to "Copy Always".
h
What exact version of Umbraco are you using? It works fine on my 10.5.1
d
I'm on 10.5.1 as well. It seems to be specific to this instance of Umbraco
h
permission issue maybe?
d
It might be? I notice that on our production environment on Azure, the App_Plugins folder is not available. However, on our testing environment, a windows server with IIS, it is available. Where would I begin searching? I wouldn't expect permissions to be an issue on azure.
Just confirmed that it is in fact an issue on my machine as my coworker can see the App_Plugins folder in this menu. That doesn't explain why I can't see it in azure though 🤔
s
Have you checked the browser's dev tools to see if there's any errors on API requests?
d
I have, there was no error in the devtools and I checked the response of the specific api call and it shows a list of results with exactly 1 item: the wwwroot folder. So it looks like the server only returns that single item
See here:
s
Ah I see, I haven't done this for a while and just realized: did you tap the ▶️ thingy in the tree to expand it, I think that should do the trick to get to a directory you're allowed to select? 🤔
d
I'm not sure which arrow you mean, but for comparison, this is what it looks like when it does work:
Notice there are 2 items in the "children" property of the response and there are 2 items visible in the menu
s
Ah you were missing App_Plugins.. ignore me! 😅 No idea, but as it seems specific to that instance of Umbraco, I think it might be some package or some config option or something. And I meant the
>
to the left of
wwwroot
- not sure what that triangle is called 😉
icon-navigation-right
apparently 😁
m
could it be a case sensitivity issue on the folder name?
doesn't seem to be doing anything beyond check directory exists and has a file? https://github.com/umbraco/Umbraco-CMS/blob/release-10.5.1/src/Umbraco.Web.BackOffice/Trees/StaticFilesTreeController.cs
any errors in the logs for unauthorised access?
Copy code
csharp
public IEnumerable<string> GetDirectories(string path)
        {
            var fullPath = GetFullPath(path);

            try
            {
                if (Directory.Exists(fullPath))
                {
                    return Directory.EnumerateDirectories(fullPath).Select(GetRelativePath);
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                _logger.LogError(ex, "Not authorized to get directories for '{Path}'", fullPath);
            }
            catch (DirectoryNotFoundException ex)
            {
                _logger.LogError(ex, "Directory not found for '{Path}'", fullPath);
            }

            return Enumerable.Empty<string>();
        }
d
Lemme check
There are no errors in the logs, but I do see that app_plugins is spelled with all lowercase characters, whereas in other projects it's spelled with capital A and P. I'm gonna try that
Genius! Changing App_Plugins to use capital letters makes it appear! Thanks a lot!!
m
Could possibly do with a health check to make sure that casing is correct as per UMB constants.. (esp for the linux crowd now) does seem to be a bit all over the place
Views\Partial\grid
_ViewImports.cshtml
wwwroot
App_Plugins
I know some is legacy.. but 🙂
s
We should just do an invariant check instead, no need for a health check if it can just be fixed in the PhysicalFileSystem.cs file. I'm assuming you're on Linux @D_Inventor?
m
can we do invariant checks though with linux support? as app_plugins and App_Plugins and App_plugins folders could all co-exist?
would you list all three folders in the tree?
is it things like
IEnumerable<string> files = _fileSystem.GetFiles(path).Where(x => x.StartsWith(AppPlugins) || x.StartsWith(Webroot));
that aren't case insensitive? https://github.com/umbraco/Umbraco-CMS/blob/release-10.5.1/src/Umbraco.Web.BackOffice/Trees/StaticFilesTreeController.cs#L63C1-L65C1
s
Hmm, fair. I'd love to know how the directory was created with the wrong casing in the first place though, might be a package that needs a quick fix?
I "love" that we also look for folders like
App_Plugins1234RANDOM
- not sure why we do
StartsWith
, seems.. weird.
d
Good question, I'm not sure how the folder was created. It might actually have been manually, as we also upgraded our custom extensions that were stored there
Looks like git is also properly confused:
git and windows are always funky with casing in that way
Among other things, SeoVisualizer and Diplo God mode are stored in the lower case variant
I'm actually not on Linux, just windows 11 and visual studio
s
Ah yes, well you're using "Linux" as in Git.. sort of. Yes, because Git is case-sensitive, this becomes a problem! Good luck fixing that by the way (hint: you need to do a full git delete of both folders, then recreate the folders with the proper casing and drop all files back in there and then PRAY that NuGet doesn't do a restore with a lower case version again because.. then you'd need to fix it again).
d
IIRC, git does not save empty folders, so perhaps a rename, push, rename, push should also do the trick...?
s
Yeah but what if you upgrade Diplo God Mode in the future and it renames the directory (not sure if it will but.. who knows).
Or your colleague made changes in the
app_plugins
lowercased folder, does a rebase after your last push and.. TADA it's lower cased again.. 😅
d
I do not fear a rebase, none of us are clever enough to know how to properly do a rebase 😂😭
s
😂 😭
In general, I'd say that packages with the wrong casing are not Linux compliant and should be fixed.
m
🤔 what is the wrong casing though?
App_Plugins
isn't consistent with
umbraco/Data/
for instance? time to aim for a upperFirstCamelCase convention? and drop this snake case?
App_Plugins harks back to App_Code, App_Browsers of framework days?
d
Sounds like a good discussion to start on github. Is probably also a very very breaking change 😅
s
Since we hardcoded it, the correct casing is
App_Plugins
and yeah, that won't change ever again as it would be a breaking change and it is difficult to change, thanks to Git -- as we've seen here.
I guess v14 won't have this directory anyway, so that's a good thing 😁
m
looks like we ended up with something half way between the two.. 😉
4 Views