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

Media Manager thumb error with no ImageProcessor #1288

Closed
i-love-code opened this issue Aug 3, 2020 · 4 comments
Closed

Media Manager thumb error with no ImageProcessor #1288

i-love-code opened this issue Aug 3, 2020 · 4 comments
Assignees
Milestone

Comments

@i-love-code
Copy link
Contributor

i-love-code commented Aug 3, 2020

I may be doing something wrong here.

Root Issue: Media thumbnails aren't working in the manager
image

It's a bit odd, because they work everywhere else. When I upload it, I see a thumbnail that it was uploaded successfully with the image. I can click the media to see the details and I see the media preview and the "get public URL" link works.

Only the thumbnail on the larger media manager page is broken.

Video of issue: https://i.gyazo.com/b794420cf553e729f9ca692ccb96d7b3.mp4

Using:

<PackageReference Include="Piranha.AspNetCore" Version="8.3.0" />
<PackageReference Include="Piranha.AspNetCore.Identity" Version="8.3.0" />
<PackageReference Include="Piranha.AspNetCore.Identity.SQLite" Version="8.3.0" />
<PackageReference Include="Piranha.AttributeBuilder" Version="8.3.0" />
<PackageReference Include="Piranha.Data.EF" Version="8.3.0" />
<PackageReference Include="Piranha.Data.EF.SQLite" Version="8.3.0" />
<PackageReference Include="Piranha.Local.FileStorage" Version="8.3.0" />
<PackageReference Include="Piranha.Manager" Version="8.3.1" />
<PackageReference Include="Piranha.Manager.TinyMCE" Version="8.3.0" />

Relevant code:

services.AddPiranha(options =>
{
     options.AddRazorRuntimeCompilation = true;

     options.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames, basePath: "wwwroot/cms-content/", baseUrl: "~/cms-content/");
     options.UseManager();
     options.UseTinyMCE();
     options.UseMemoryCache();
     options.UseEF<SQLiteDb>(db => db.UseSqlite(configuration.GetConnectionString("CMS")));
     options.UseIdentityWithSeed<IdentitySQLiteDb>(db => db.UseSqlite(configuration.GetConnectionString("CMS")));
});

(The upload and path appear to match the startup)
image

@i-love-code
Copy link
Contributor Author

Forgot this, the 500 error:

System.ArgumentException: Value cannot be null or empty. (Parameter 'url')
   at Microsoft.AspNetCore.Mvc.ControllerBase.Redirect(String url)
   at Piranha.Manager.Controllers.MediaApiController.GetUrl(Guid id, Nullable`1 width, Nullable`1 height)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Piranha.AspNetCore.SitemapMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
   at Piranha.AspNetCore.IntegratedMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

@i-love-code
Copy link
Contributor Author

It appears to be something within in the media controller:

if (media != null)
{
        return Redirect(media.PublicUrl);
}

I just haven't figured out yet why, only in the media manager thumbnail preview, this PublicUrl is null/empty when it generates one fine (seen in the video, it knows the public URL)

@i-love-code i-love-code changed the title FileStorage Media Manager 404 FileStorage Media Manager Thumbnail 500 Aug 3, 2020
@i-love-code
Copy link
Contributor Author

i-love-code commented Aug 3, 2020

I guess you can kinda call this solved? I had a hunch since the URL it was failing to resolve was /api/media/210/100 that it was trying to get a resized thumbnail and the 500 was likely due to not using the ImageSharp nuget package. I installed it and added UseImageSharp() and it functions now.

Is there a hard dependency on ImageSharp in the manager, or can it be opted out of? If I didn't want to have image resizing/etc, I'd assume the manager would still work.

If this was documented somewhere, my apologies.

@tidyui
Copy link
Member

tidyui commented Aug 6, 2020

There’s not supposed to be a hard dependency and the original file should be returned when there’s no processor registered but apparently something is not checking this the correct way.

@tidyui tidyui changed the title FileStorage Media Manager Thumbnail 500 Media Manager thumb error with no ImageProcessor Aug 6, 2020
@tidyui tidyui added this to the Version 8.4 milestone Aug 10, 2020
@tidyui tidyui added core-manager and removed core labels Aug 10, 2020
@tidyui tidyui self-assigned this Aug 10, 2020
@tidyui tidyui closed this as completed in 404811d Aug 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants