Can't add media on Orchard v.1.10.1.0 - orchardcms

I did a setup of an Orchard v.1.10.1.0 with the default recipe and can't add media. The Javascript console shows this error:
GET https://website.azurewebsites.net/Media/Default/_Profiles/1338a03e/abbfa561/header.png?v=636100967487424883 404 (Not Found)
Uncaught TypeError: deepestChildPath.contains is not a function

This is a known bug in Orchard 1.10. You should be able to fix it by changing line 385 in Orchard.Web/Modules/Orchard.MediaLibrary/Scripts/media-library.js
to var separator = deepestChildPath.indexOf('/') > -1 ? '/' : '\\';
as shown in the GitHub history.

Related

Custom page Error doesn't work. (in production always return code 500)

So i'm working on a project and i wanted to make custom error page like 404 500 ...
So i read on symfony documentation that all i have to do is composer twig-pack, then add the error404.html.twig in this tree directory \templates\bundles\TwigBundle\Exception. To finish I have to change my .env in prod to see my beauty error page.
But when i try to type a wrong url expecting to get my 404, instead, i got a 500 (the basic error page from symfony).
I checked my logs and i found that i got this Critical Error :
[2021-07-14T08:35:15.194689+00:00] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET https://micro59/dejifosd"" at C:\wamp\www\Projects\micropro\vendor\symfony\http-kernel\EventListener\RouterListener.php line 136 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET https://micro59/dejifosd\" at C:\\wamp\\www\\Projects\\micropro\\vendor\\symfony\\http-kernel\\EventListener\\RouterListener.php:136)\n[previous exception] [object] (Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException(code: 0): No routes found for \"/dejifosd/\". at C:\\wamp\\www\\Projects\\micropro\\vendor\\symfony\\routing\\Matcher\\Dumper\\CompiledUrlMatcherTrait.php:70)"} []
[2021-07-14T08:35:15.229712+00:00] php.CRITICAL: Uncaught Error: Symfony\Bridge\Twig\Extension\RoutingExtension::getPath(): Argument #1 ($name) must be of type string, null given, called in C:\wamp\www\Projects\micropro\var\cache\prod\twig\d5\d51256555fdd9ed9db40150aba9ba2f8325c04e57ae45e60937191a29447ddd2.php on line 37 {"exception":"[object] (TypeError(code: 0): Symfony\\Bridge\\Twig\\Extension\\RoutingExtension::getPath(): Argument #1 ($name) must be of type string, null given, called in C:\\wamp\\www\\Projects\\micropro\\var\\cache\\prod\\twig\\d5\\d51256555fdd9ed9db40150aba9ba2f8325c04e57ae45e60937191a29447ddd2.php on line 37 at C:\\wamp\\www\\Projects\\micropro\\vendor\\symfony\\twig-bridge\\Extension\\RoutingExtension.php:46)"} []
[2021-07-14T08:35:15.232242+00:00] request.CRITICAL: Uncaught PHP Exception TypeError: "Symfony\Bridge\Twig\Extension\RoutingExtension::getPath(): Argument #1 ($name) must be of type string, null given, called in C:\wamp\www\Projects\micropro\var\cache\prod\twig\d5\d51256555fdd9ed9db40150aba9ba2f8325c04e57ae45e60937191a29447ddd2.php on line 37" at C:\wamp\www\Projects\micropro\vendor\symfony\twig-bridge\Extension\RoutingExtension.php line 46 {"exception":"[object] (TypeError(code: 0): Symfony\\Bridge\\Twig\\Extension\\RoutingExtension::getPath(): Argument #1 ($name) must be of type string, null given, called in C:\\wamp\\www\\Projects\\micropro\\var\\cache\\prod\\twig\\d5\\d51256555fdd9ed9db40150aba9ba2f8325c04e57ae45e60937191a29447ddd2.php on line 37 at C:\\wamp\\www\\Projects\\micropro\\vendor\\symfony\\twig-bridge\\Extension\\RoutingExtension.php:46)"} []
Aaaaaaaand thats where i'm stuck. I try many things (Composer update, Clear cache...) but nothing change. If someone would have the kindness to help me that would be much appreciate it.
The class & method in the error message, RoutingExtension::getPath(), defines a Twig function - path(). Your error404.html.twig file uses that function but doesn't have the required first parameter ('name', the route name) - or the value that is being passed to it, is null.
How to Customize Error Pages has a simple error-page template, and has a sample path/route-name {{ path('homepage') }}.
You can get a list of the routes you have available so far with bin/console debug:router - it must be known to the framework, or it will throw an error about an unknown route.
It also has a .yaml you can use to make the error pages available in development (your controller is fine, this would be a bit cleaner and easier - and would only be available in development because of the path within the config/ directory is only read when your APP_ENV variable is 'dev').
If you have not already, composer require debug-pack and any errors - including on your '/error404' page will show a 'big friendly error page', should also add a lot of useful information - often including showing the file and line in the twig template.
In this particular instance, because of the type of error, it can't as it's deep in the Twig library internals (and comes from the PHP type-system, not an error found directly by Symfony or Twig) - but it will have a link in the stack trace to show the compiled twig template (in a randomly named file in ./var/cache/dev/twig/../.......php) and it shows where in the twig template it's calling the ->getPath(); - so you'll be able to track it down in the actual .twig file (it adds comments for the line number within the template to help).

Page Type of a class name not found exception

I am new to Kentico and going through the Kentico 12 MVC Training Course using the MedioClinic sample project. On running the MVC project for live site I am getting the below error. Could someone please help me with this.
Server Error in '/Kentico12_MedioClinic' Application.
Page type with 'MedioClinic.HomeSection' class name not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CMS.DocumentEngine.DocumentTypeNotExistsException: Page type with 'MedioClinic.HomeSection' class name not found.
Source Error:
Line 38: {
Line 39: var query = DocumentHelper.GetDocuments();
Line 40:
Line 41: // Loads the latest version of documents as preview mode is enabled
Line 42: if (SiteContext.IsPreviewEnabled)
Source File: C:\Users\A0808038\Desktop\Kentico\training-kentico-k12-master\training-kentico-k12-master\Business\Services\Query\DocumentQueryService.cs Line: 40
Thanks in Advance
From the admin area go to edit the page type "MedioClinic.HomeSection" and click on the vertical tab "Code" then from there click on generate code, so those are saved physically on the /CMS/Old_App_code folder from the WebApp solution.
Copy that generated file to your MVC project, add the correct using to your class and that should fix the issue.

Google Pagespeed giving error "cloned graph missing node" in eliminate render blocking resource

Google pagespeed is giving error "cloned graph missing node". I have used styled components to eliminate render blocking resource . What does this error mean?
I had the same error. In my case there where faulty script and link Tags - for some reason the src and href attributes where empty. By removing those Tags I fixed the issue.
To look deeper into the reason behind this error you can find the code where the error is thrown here
https://github.com/GoogleChrome/lighthouse/blob/fa70748c46fc1fb4236417ecb8848f965cd1613f/lighthouse-core/lib/dependency-graph/base-node.js
const clonedThisNode = idsToIncludedClones.get(this.id);
if (!clonedThisNode) throw new Error('Cloned graph missing node');
return clonedThisNode;

GitLab - Getting 404 (Not Found) for /assets/ace/mode-markdown.js

I am getting the following error from GitLab while editing the code online.
GET http://git.server.local/assets/ace/mode-markdown.js 404 (Not Found) application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:26
t.loadScript application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:26
t.loadModule application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:26
setMode application-c8cd2dd87cbf8a023b21baf4d6996ac9.js:27
(anonymous function)
Has anyone encountered such an error? I wonder why an asset without a hash is being requested by the app.
It is an Omnibus install.
I prepared a fix here. This also adds syntax highlighting when creating a new file in the repository or a new snippet.
Until it is properly resolved at some point in time, I have gotten the error resolved by copying the "ace" folder from the ace-rails-ap repository to the GitLab public/assets folder.
https://github.com/codykrieger/ace-rails-ap/tree/master/vendor/assets/javascripts
It seems the asset is requested by the following Javascript that gets inline with the code.
Probably introduced in this commit https://github.com/gitlabhq/gitlabhq/commit/1794f606bd74ae775cd10a3f7da293fb67134c1c
# gitlab-ce.git/app/views/projects/edit_tree/show.html.haml
:javascript
ace.config.set("modePath", gon.relative_url_root + "#{Gitlab::Application.config.assets.prefix}/ace")
var ace_mode = "#{#blob.language.try(:ace_mode)}";
var editor = ace.edit("editor");
editor.setValue("#{escape_javascript(#blob.data)}");
if (ace_mode) {
editor.getSession().setMode('ace/mode/' + ace_mode);
}
Since the inline Javascript does not know anything about Rails asset management, it is assuming that the file would be there in assets folder.

XPages Custom Error Page - get error message and line

I'm trying to generate a custom error page for my xpages. I googled a lot of solutions and so far I get an error page telling me, that an error occured.
But I can't get the information what exactly happened (in this case the error is, that an "doc" has to be saved, but i named the variable "docs" just to get error).
All I do is:
var errObj = requestScope.error;
output = errObj.getCause().getErrorPropertyId();
output = errObj.getCause().getComponentId();
As soon as I try to call getExpressionText() I get an error 500.
How do I get the information, where the error happened (line number) and the variable that caused the error? - just like I do using the standard error page.
The error line and details are not easily accessible from requestScope.error. If you look at the source code for the latest release of Mark Leusink's Debug Toolbar, you'll see he's parsing the stack trace to get the details.
However, you can access all the relevant information using the underlying Java class for the SSJS exception - com.ibm.jscript.InterpretException using getErrorLine(). The getLocalizedMessage() method gets the error detail that usually starts "Script interpreter error". The getExpressionText() method retrieves the line that threw the error.
If you take a look at the XPages OpenLog Logger project I put on OpenNTF, that's what I use to log full details to OpenLog. http://www.openntf.org/Internal/home.nsf/project.xsp?action=openDocument&name=XPages%20OpenLog%20Logger
You can see the source code of the OpenLogPhaseListener which uses those methods here: https://github.com/paulswithers/openlogjava/blob/master/OpenLogJava/WebContent/WEB-INF/src/com/paulwithers/openLog/OpenLogPhaseListener.java
Even if you're not a Java expert, from use of SSJS the key parts should be understandable. Line 84 captures uncaught exceptions - when XPages routes to the default error page. That uses the methods I mentioned.
Lines 98 to 105 are the ones that log out all the details if you just use a catch block, passing OpenLogBean.addError(e, this) where e is the error object and this is the component the error occurs on. error.getError() in the Java code retrieves that error object. To get the typeahead in SSJS you'll need to use catch(e:com.ibm.jscript.InterpretException) I believe.
I haven't tested this, I've just working back from what I used for the project on OpenNTF.
Have a look at this XSnippet by Tony McGuckin: http://openntf.org/XSnippets.nsf/snippet.xsp?id=custom-error-page-cw-cause-and-stacktrace-information. It uses the following to output details on the error:
var output = requestScope.error.toString()+"\n\n";
if(requestScope.error instanceof com.ibm.xsp.exception.XSPExceptionInfo){
var codeSnippet = requestScope.error.getErrorText();
var control = requestScope.error.getErrorComponentId();
var cause = requestScope.error.getCause();
output += "In the control : " + control + "\n\n";
if(cause instanceof com.ibm.jscript.InterpretException){
var errorLine = cause.getErrorLine();
var errorColumn = cause.getErrorCol();
output += "At line " + errorLine;
output += ", column " + errorColumn + " of:\n";
}else{
output += "In the script:\n";
}
output += codeSnippet;
}
return output;
For now I've dealt with this problem by using the Debug Toolbar and the OpenLog Database.
If an error occurs the user only gets a custom error page (using the example of the Debug Toolbar) with the information, that something went wrong. So he does not have to bother with any other problems or even the Stack Trace. But at the same moment he gets the error page, the error is logged in our Log-Database with all informations needed (like line, exact error message etc.).
I've also implemented an "Report this problem" Link-Button to create a new E-Mail containing important information about the session the user is currently in.

Resources