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

Failed to delete Media Item in Umbraco 13 #18055

Open
humandigital-michiel opened this issue Jan 21, 2025 · 8 comments
Open

Failed to delete Media Item in Umbraco 13 #18055

humandigital-michiel opened this issue Jan 21, 2025 · 8 comments
Labels
state/needs-reproduction Check if this can be reproduced in the latest released version type/bug

Comments

@humandigital-michiel
Copy link

humandigital-michiel commented Jan 21, 2025

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

13.5.3

Bug summary

Added a Media item (png file) in the root of the Media folder. Saved. And after that i deleted it. I get the following result:

Failed to delete item 47850
Sequence contains no elements

Exception Details
System.InvalidOperationException, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Sequence contains no elements
Stacktrace
at System.Linq.ThrowHelper.ThrowNoElementsException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
   at NPoco.Database.First[T](Sql sql)
   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.ContentRepositoryBase`3.GetParentNodeDto(Int32 parentId)
   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.MediaRepository.PersistUpdatedItem(IMedia entity)
   at Umbraco.Cms.Core.Cache.DefaultRepositoryCachePolicy`2.Update(TEntity entity, Action`1 persistUpdated)
   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.EntityRepositoryBase`2.Save(TEntity entity)
   at Umbraco.Cms.Core.Services.MediaService.PerformMoveMediaLocked(IMedia media, Nullable`1 trash)
   at Umbraco.Cms.Core.Services.MediaService.PerformMoveLocked(IMedia media, Int32 parentId, IMedia parent, Int32 userId, ICollection`1 moves, Nullable`1 trash)
   at Umbraco.Cms.Core.Services.MediaService.MoveToRecycleBin(IMedia media, Int32 userId)
   at Umbraco.Cms.Web.BackOffice.Controllers.MediaController.DeleteById(Int32 id)
   at lambda_method2888(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
   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 ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Specifics

https://localhost:44375/umbraco#/media/media/edit/47850?mculture=nl

Steps to reproduce

Image

When i try the same actions on a Umbraco 12 database. Umbraco 12.3.9, this works fine.

Also when i try to delete a content page, it also works fine.

Is there something changed in between versions? Do i need some configuration?

Expected result / actual result

A deleted file.

Copy link

Hi there @humandigital-michiel!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@AndyButland AndyButland added the state/needs-reproduction Check if this can be reproduced in the latest released version label Jan 21, 2025
@AndyButland
Copy link
Contributor

I've had a quick look at this using the latest and previous versions. The replication steps seem clear, but I don't see this behaviour.

@humandigital-michiel
Copy link
Author

that's unfortunate. Can I try something else to get more logging? Is there perhaps a setting that i could touch?

@AndyButland
Copy link
Contributor

I think you've probably shared all you can. Might just be worth me asking, if you have time, to see if you can see this on a clean installation? If so, then there should be no reason why I can't replicate. If not, then we might then need to look into what's specific about your project that is causing it.

@humandigital-michiel
Copy link
Author

humandigital-michiel commented Jan 22, 2025

Ok, just ran a vanilla umbraco 13.5.3 against our customer database, and i've got the error.
So something is not correct in the database. It is not in config or code.

@AndyButland
Copy link
Contributor

AndyButland commented Jan 22, 2025

Assuming you don't see it on a newly installed database, is there any chance you could share the customer database with me? Perhaps first having deleted members or anything else with PII etc.. If so, you can reach me at abl AT umbraco DOT dk to send me a download link.

@humandigital-michiel
Copy link
Author

We are missing item -21 in umbracoNode

SET IDENTITY_INSERT umbracoNode ON;

INSERT INTO umbracoNode (id, uniqueId, parentId, level, path, sortOrder, trashed, nodeUser, text, nodeObjectType, createDate)
VALUES (-21, 'BF7C7CBC-952F-4518-97A2-69E9C7B33842', -1, 0, '-1,-21', 0, 0, -1, 'Recycle Bin', 'CF3D8E34-1C1C-41E9-AE56-878B57B32113', '2019-06-24 12:05:47.067');

SET IDENTITY_INSERT umbracoNode OFF;

This resolves it!

@AndyButland
Copy link
Contributor

Glad you've managed to fix your issue. Do you have any idea how this record got removed? If we can identify that would be good to know, as you clearly shouldn't be able to delete your recycle bin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state/needs-reproduction Check if this can be reproduced in the latest released version type/bug
Projects
None yet
Development

No branches or pull requests

2 participants